From d8d3770f88d6acc37620d6577fa5a0b026fb1231 Mon Sep 17 00:00:00 2001 From: ubq323 Date: Wed, 3 Jul 2024 12:01:22 +0100 Subject: add some failing tests for closures --- tests/clos4.bth | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 tests/clos4.bth (limited to 'tests/clos4.bth') diff --git a/tests/clos4.bth b/tests/clos4.bth new file mode 100644 index 0000000..c9a2092 --- /dev/null +++ b/tests/clos4.bth @@ -0,0 +1,29 @@ +(defn (f) + (let (a 0) + (defn (s x) (set a x)) + (defn (g) a) + [s g])) + + +(def a1 (f)) +(def s1 (a1 0)) +(def g1 (a1 1)) + +(def a2 (f)) +(def s2 (a2 0)) +(def g2 (a2 1)) + +(say (g1)) +(say (g2)) + +(s1 6) +(say (g1)) +(say (g2)) + +(s2 70) +(say (g1)) +(say (g2)) + +(s2 (* (g1) (g1))) +(say (g1)) +(say (g2)) -- cgit v1.2.3