aboutsummaryrefslogtreecommitdiffstats
path: root/lib/csc/macros-test.csc
diff options
context:
space:
mode:
authorRose Hogenson <rhogenson@posteo.net>2022-08-04 21:45:54 -0700
committerRose Hogenson <rhogenson@posteo.net>2022-08-04 21:45:54 -0700
commitde9353e9c24c448aaa11e24f2ccfb1820acb3d34 (patch)
tree5ad341c306908630d8de47d2da3ad0e59eaff624 /lib/csc/macros-test.csc
parentStart the scheme base library. (diff)
downloadchromatopelma-de9353e9c24c448aaa11e24f2ccfb1820acb3d34.tar.zst
Add if and set!.
Diffstat (limited to 'lib/csc/macros-test.csc')
-rw-r--r--lib/csc/macros-test.csc24
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/csc/macros-test.csc b/lib/csc/macros-test.csc
index 531e3e2..9b4c128 100644
--- a/lib/csc/macros-test.csc
+++ b/lib/csc/macros-test.csc
@@ -32,9 +32,11 @@
make-call-builtin
make-constant
make-define-syntax
+ make-if
make-lambda
make-letrec
make-lexical-ref
+ make-lexical-set
make-library-ref
make-sequence
sequence?)
@@ -291,4 +293,26 @@
(expand-body 'main
'((call-builtin bbb 5))
builtins-environment)
+ transform-ir1))
+
+
+ (test builtin-lexical-set
+ (assert-equal
+ (make-lambda (list (test-ref 'x)) #f
+ (make-sequence
+ (make-constant #f)
+ (make-lexical-set (test-ref 'x) (make-constant 5))))
+ (expand-body 'main
+ '((lambda (x)
+ (set! x 5)))
+ builtins-environment)
+ transform-ir1))
+
+
+ (test builtin-if
+ (assert-equal
+ (make-if (make-constant #t) (make-constant 5) (make-constant 10))
+ (expand-body 'main
+ '((builtin-if #t 5 10))
+ builtins-environment)
transform-ir1))))