From f8ab6f0ac519f920c417bc3f7d880e3e687e60d4 Mon Sep 17 00:00:00 2001 From: Joel Martin Date: Tue, 6 Aug 2024 13:16:23 -0500 Subject: [PATCH 1/2] tests/step3: check that nil can be bound env value --- impls/tests/step3_env.mal | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/impls/tests/step3_env.mal b/impls/tests/step3_env.mal index 1a84d442d4..5e77c4666f 100644 --- a/impls/tests/step3_env.mal +++ b/impls/tests/step3_env.mal @@ -14,6 +14,12 @@ x ;=>4 x ;=>4 +(def! x nil) +x +;=>nil +(def! x 5) +x +;=>5 (def! y (+ 1 7)) ;=>8 y @@ -44,7 +50,7 @@ w (let* (x 9) x) ;=>9 x -;=>4 +;=>5 (let* (z (+ 2 3)) (+ 1 z)) ;=>6 (let* (p (+ 2 3) q (+ 2 p)) (+ p q)) From 11cf2f6c36340b8609f6c214afd68f701030769b Mon Sep 17 00:00:00 2001 From: Joel Martin Date: Tue, 6 Aug 2024 13:17:09 -0500 Subject: [PATCH 2/2] tests/step4: check closure binds name (not value) --- impls/tests/step4_if_fn_do.mal | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/impls/tests/step4_if_fn_do.mal b/impls/tests/step4_if_fn_do.mal index b98f2dae2a..aeab17b3f1 100644 --- a/impls/tests/step4_if_fn_do.mal +++ b/impls/tests/step4_if_fn_do.mal @@ -202,6 +202,15 @@ (plus7 8) ;=>15 +;; Testing lexical function scope binds names (not values) +(def! a 12) +(def! fx (fn* () a)) +(fx) +;=>12 +(def! a 2000) +(fx) +;=>2000 + ;; Testing do form (do (prn 101)) ;/101