Skip to content

Commit c49baac

Browse files
committed
Add test to ensure no regression on side effect bug
1 parent 9033667 commit c49baac

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

tests/known-bugs/solution.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
foo = \ x j c . x c ()

tests/known-bugs/test.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import {readFileSync} from "fs";
2+
import {assert, config as chaiConfig} from "chai";
3+
chaiConfig.truncateThreshold = 0;
4+
5+
import * as LC from "../../src/lambda-calculus.js";
6+
LC.configure({ purity: "Let", numEncoding: "None" });
7+
8+
const solutionText = readFileSync(new URL("./solution.txt", import.meta.url), {encoding: "utf8"});
9+
const { foo } = LC.compile(solutionText);
10+
11+
describe("No side effects", () => {
12+
it("The initial failed call used to cause the second call to behave weirdly", () => {
13+
try {
14+
foo("hi")("there")("world")
15+
} catch {}
16+
assert.strictEqual( foo(null).term.toString(), "\\ j c . x c ()" );
17+
});
18+
});

0 commit comments

Comments
 (0)