feat: Add a couple of ways to install generics safely. #18
2 changed files with 10 additions and 0 deletions
3
src/generic/subtract.concrete.mjs
Normal file
3
src/generic/subtract.concrete.mjs
Normal file
|
@ -0,0 +1,3 @@
|
|||
export {subtract} from './subtract.mjs'
|
||||
export * from '../number/add.mjs'
|
||||
export * from '../number/negate.mjs'
|
|
@ -6,6 +6,7 @@ import * as numberAdd from '../src/number/add.mjs'
|
|||
import * as complex from '../src/complex/all.mjs'
|
||||
import * as complexAdd from '../src/complex/add.mjs'
|
||||
import * as complexNegate from '../src/complex/negate.mjs'
|
||||
import * as concreteSubtract from '../src/generic/subtract.concrete.mjs'
|
||||
import extendToComplex from '../src/complex/extendToComplex.mjs'
|
||||
|
||||
const bw = new PocomathInstance('backwards')
|
||||
|
@ -55,4 +56,10 @@ describe('A custom instance', () => {
|
|||
assert.strictEqual('subtract' in cherry, false)
|
||||
assert.strictEqual('negate' in cherry, false)
|
||||
})
|
||||
|
||||
it("can use bundles that are closed under dependency", () => {
|
||||
const ok = new PocomathInstance('concrete')
|
||||
ok.install(concreteSubtract)
|
||||
assert.strictEqual(ok.subtract(7, 5), 2)
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Add table
Reference in a new issue