Skip to content

Commit

Permalink
Add test to ensure no regression on side effect bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Kacarott committed Jan 6, 2024
1 parent 9033667 commit c49baac
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/known-bugs/solution.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
foo = \ x j c . x c ()
18 changes: 18 additions & 0 deletions tests/known-bugs/test.js
Original file line number Diff line number Diff line change
@@ -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 ()" );
});
});

0 comments on commit c49baac

Please sign in to comment.