From 0fba6544b4d502cbe0bde6688544f7d5816ffa56 Mon Sep 17 00:00:00 2001 From: Glen Whitney Date: Fri, 22 Jul 2022 18:56:31 -0700 Subject: [PATCH] feat: A module that supplies subtract and its dependencies (for numbers) --- src/generic/subtract.concrete.mjs | 3 +++ test/custom.mjs | 7 +++++++ 2 files changed, 10 insertions(+) create mode 100644 src/generic/subtract.concrete.mjs diff --git a/src/generic/subtract.concrete.mjs b/src/generic/subtract.concrete.mjs new file mode 100644 index 0000000..39638aa --- /dev/null +++ b/src/generic/subtract.concrete.mjs @@ -0,0 +1,3 @@ +export {subtract} from './subtract.mjs' +export * from '../number/add.mjs' +export * from '../number/negate.mjs' diff --git a/test/custom.mjs b/test/custom.mjs index aabbb8c..72ba2d0 100644 --- a/test/custom.mjs +++ b/test/custom.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) + }) })