feat: Template types (#45)
Includes a full implementation of a type-homogeneous Tuple type, using the template types feature, as a demonstration/check of its operation. Co-authored-by: Glen Whitney <glen@studioinfinity.org> Reviewed-on: #45
This commit is contained in:
parent
fd32ee1f10
commit
845a2354c9
28 changed files with 920 additions and 129 deletions
22
test/core/dependencyExtractor.mjs
Normal file
22
test/core/dependencyExtractor.mjs
Normal file
|
@ -0,0 +1,22 @@
|
|||
import assert from 'assert'
|
||||
import {dependencyExtractor} from '../../src/core/extractors.mjs'
|
||||
|
||||
describe('dependencyExtractor', () => {
|
||||
it('will record the keys of a destructuring function', () => {
|
||||
const myfunc = ({a, 'b(x)': b, c: alias}) => 0
|
||||
const params = new Set()
|
||||
myfunc(dependencyExtractor(params))
|
||||
assert.ok(params.has('a'))
|
||||
assert.ok(params.has('b(x)'))
|
||||
assert.ok(params.has('c'))
|
||||
assert.ok(params.size === 3)
|
||||
})
|
||||
|
||||
it('does not pick up anything from a regular function', () => {
|
||||
const myfunc = arg => 0
|
||||
const params = new Set()
|
||||
myfunc(dependencyExtractor(params))
|
||||
assert.ok(params.size === 0)
|
||||
})
|
||||
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue