diff --git a/tests/known-bugs/solution.txt b/tests/known-bugs/solution.txt new file mode 100644 index 0000000..4822a76 --- /dev/null +++ b/tests/known-bugs/solution.txt @@ -0,0 +1 @@ +foo = \ x j c . x c () diff --git a/tests/known-bugs/test.js b/tests/known-bugs/test.js new file mode 100644 index 0000000..8f7f7c1 --- /dev/null +++ b/tests/known-bugs/test.js @@ -0,0 +1,18 @@ +import {readFileSync} from "fs"; +import {assert, config as chaiConfig} from "chai"; +chaiConfig.truncateThreshold = 0; + +import * as LC from "../../src/lambda-calculus.js"; +LC.configure({ purity: "Let", numEncoding: "None" }); + +const solutionText = readFileSync(new URL("./solution.txt", import.meta.url), {encoding: "utf8"}); +const { foo } = LC.compile(solutionText); + +describe("No side effects", () => { + it("The initial failed call used to cause the second call to behave weirdly", () => { + try { + foo("hi")("there")("world") + } catch {} + assert.strictEqual( foo(null).term.toString(), "\\ j c . x c ()" ); + }); +});