This commit is contained in:
1 parent
2f6160f178
commit
35bbd7ffef
2 files changed
+73
-35
No files matched your search
+20
-6
@@ -46,6 +46,9 @@
|
||||
(defn- us-expand [datum]
|
||||
(sut/unscope (sut/expand datum)))
|
||||
|
||||
(defn- rg-expand [datum]
|
||||
(sut/regensym (sut/expand datum)))
|
||||
|
||||
(t/deftest expand-test
|
||||
(t/testing "unbound symbol"
|
||||
(t/is (thrown? Exception (sut/expand 'x))))
|
||||
@@ -53,11 +56,11 @@
|
||||
(t/is (= '(lambda (x) x)
|
||||
(us-expand '(λ (x) x)))))
|
||||
#_(t/testing "syntax-rules"
|
||||
(t/is (= '(lambda (x) x)
|
||||
(sut/expand
|
||||
'(syntax-rules
|
||||
()
|
||||
((_)))))))
|
||||
(t/is (= '(lambda (x) x)
|
||||
(sut/expand
|
||||
'(syntax-rules
|
||||
()
|
||||
((_)))))))
|
||||
(t/testing "let"
|
||||
(t/is (= '(let ((x 123)
|
||||
(y 456))
|
||||
@@ -68,7 +71,18 @@
|
||||
(+ x y))))))
|
||||
(t/testing "application"
|
||||
(t/is (= '(lambda (f x) (f x))
|
||||
(us-expand '(lambda (f x) (f x)))))))
|
||||
(us-expand '(lambda (f x) (f x))))))
|
||||
(t/testing "macros"
|
||||
(t/testing "when"
|
||||
(t/is (= '(let ((x 123)) (if x 456))
|
||||
(us-expand '(let ((x 123))
|
||||
(when x 456)))))
|
||||
(t/is (= '(let (([body #{s0}] 123))
|
||||
(if [body #{s0}]
|
||||
456))
|
||||
(rg-expand '(let ((body 123))
|
||||
(when body 456))))
|
||||
"`when` is hygienic"))))
|
||||
|
||||
(t/deftest prim-lambda-spec
|
||||
(t/is (s/valid? ::sut/prim-lambda '(lambda (x) x)))
|
||||
|
||||
Reference in new issue
Block a user