aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Peter McGoron 2024-12-31 14:29:56 -0500
committerGravatar Peter McGoron 2024-12-31 14:29:56 -0500
commit53836938b943476f4653bdafa26ccd05924e00cc (patch)
treed915afd9e7d829ad443da13a2762f44a8caadd35
parentunquote self evaluating objects (diff)
add more tests related to quotes
-rw-r--r--test.scm28
1 files changed, 26 insertions, 2 deletions
diff --git a/test.scm b/test.scm
index eb09065..9f409f0 100644
--- a/test.scm
+++ b/test.scm
@@ -18,7 +18,16 @@
(cps->sexpr (core->cps 'x)))
(test "quote"
'(pass ((quote x)) () __toplevel)
- (cps->sexpr (core->cps ''x))))
+ (cps->sexpr (core->cps ''x)))
+ (test "multiple quotes on a symbol"
+ '(pass ((quote (quote (quote x)))) () __toplevel)
+ (cps->sexpr (core->cps ''''x)))
+ (test "quoted constant"
+ '(pass (#f) () __toplevel)
+ (cps->sexpr (core->cps ''#f)))
+ (test "multiple quotes on a constant"
+ '(pass ((quote (quote #f))) () __toplevel)
+ (cps->sexpr (core->cps '''#f))))
(test-group "function application"
(test "thunk"
@@ -33,6 +42,9 @@
(test "one quoted arg"
'(apply x ((quote y)) () __toplevel)
(cps->sexpr (core->cps '(x 'y))))
+ (test "one quoted constant arg"
+ '(apply x (#t) () __toplevel)
+ (cps->sexpr (core->cps '(x '#t))))
(test "one compound arg"
'(apply f (x) () (kappa (__v2) __γ1 (apply x (__v2) __γ1 __toplevel)))
(cps->sexpr (core->cps '(x (f x)))))
@@ -67,10 +79,22 @@
(test "if #t"
'(pass (y) () __toplevel)
(cps->sexpr (core->cps '(if #t y z))))
+ (test "if (quote #t)"
+ '(pass (y) () __toplevel)
+ (cps->sexpr (core->cps '(if '#t y z))))
(test "if #f"
'(pass (z) () __toplevel)
(cps->sexpr (core->cps '(if #f y z))))
+ (test "if (quote #f)"
+ '(pass (z) () __toplevel)
+ (cps->sexpr (core->cps '(if '#f y z))))
+ (test "if ''#f"
+ '(pass (y) () __toplevel)
+ (cps->sexpr (core->cps '(if ''#f y z))))
(test "if truthy number"
'(pass (y) () __toplevel)
- (cps->sexpr (core->cps '(if 5 y z)))))
+ (cps->sexpr (core->cps '(if 5 y z))))
+ (test "if symbol"
+ '(pass (y) () __toplevel)
+ (cps->sexpr (core->cps '(if 'x y z)))))