From ffa93cbbfdae54069d14f655ea30f2b46e781a04 Mon Sep 17 00:00:00 2001 From: Mike Bostock Date: Mon, 9 Sep 2019 22:27:13 -0700 Subject: [PATCH] Another test for canonical resolution. --- test/variable/derive-test.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/variable/derive-test.js b/test/variable/derive-test.js index 26a3e713..2cc65eb0 100644 --- a/test/variable/derive-test.js +++ b/test/variable/derive-test.js @@ -59,3 +59,19 @@ tape("module.derive(…) does not copy non-injected modules", async test => { test.strictEqual(g._inputs[0]._module, CB); test.strictEqual(g._inputs[0]._inputs[0]._module, A); }); + +tape("module.derive(…) does not copy non-injected modules, again", async test => { + const runtime = new Runtime(); + const A = runtime.module(); + A.define("a", () => ({})); + const B = runtime.module(); + B.import("a", A); + const C = runtime.module(); + const CB = B.derive([], C); + const a1 = C.variable(true).import("a", "a1", CB); + const a2 = C.variable(true).import("a", "a2", A); + const {value: v1} = await valueof(a1); + const {value: v2} = await valueof(a2); + test.deepEqual(v1, {}); + test.strictEqual(v1, v2); +});