feat: Add all remaining features of original Picomath PoC
This commit is contained in:
parent
92485678f1
commit
ac826916ec
2 changed files with 32 additions and 1 deletions
13
test/_PocomathInstance.mjs
Normal file
13
test/_PocomathInstance.mjs
Normal file
|
@ -0,0 +1,13 @@
|
|||
import assert from 'assert'
|
||||
import PocomathInstance from '../PocomathInstance.mjs'
|
||||
|
||||
describe('PocomathInstance', () => {
|
||||
it('creates an instance that can define typed-functions', () => {
|
||||
const pi = new PocomathInstance('dummy')
|
||||
pi.install({'add': {'any,any': [[], (a,b) => a+b]}})
|
||||
assert.strictEqual(pi.add(2,2), 4)
|
||||
assert.strictEqual(pi.add('Kilroy', 17), 'Kilroy17')
|
||||
assert.strictEqual(pi.add(1, undefined), NaN)
|
||||
assert.throws(() => pi.add(1), TypeError)
|
||||
})
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue