tests
This commit is contained in:
1 parent
7700b231c9
commit
0f1287b760
4 files changed
+15
-16
No files matched your search
@@ -9,5 +9,6 @@
|
||||
io.github.msyds/spec-dict
|
||||
{:git/sha "531d629b7f05f37232261cf9e8927a4b5915714f"}}
|
||||
:paths ["src" "resources" "test"]
|
||||
:test {:extra-deps {lambdaisland/kaocha {:mvn/version "1.91.1392"}}
|
||||
:main-opts ["-m" "kaocha.runner"]}}
|
||||
:aliases
|
||||
{:test {:extra-deps {lambdaisland/kaocha {:mvn/version "1.91.1392"}}
|
||||
:main-opts ["-m" "kaocha.runner"]}}}
|
||||
+2
-14
@@ -86,6 +86,8 @@
|
||||
(swap! symtable-ref #(assoc-in % [sym scopes] bind))
|
||||
{bind denot}))
|
||||
|
||||
(declare expand)
|
||||
|
||||
(defmethod expand-primitive 'lambda
|
||||
[datum _ env symtable-ref scopes]
|
||||
(let [[_ formals & body] datum
|
||||
@@ -98,20 +100,6 @@
|
||||
(for [e body]
|
||||
(expand e env* symtable-ref scopes*)))))
|
||||
|
||||
(comment (assert (lookup ['lambda #{}]
|
||||
scheme-base-env
|
||||
(symtable-for-env scheme-base-env))))
|
||||
|
||||
(comment
|
||||
(nearest ['x #{0 1 2}]
|
||||
#{#{0}
|
||||
#{0 1}
|
||||
#{0 3}}))
|
||||
|
||||
(comment
|
||||
(expand 'x)
|
||||
(expand '(lambda (x) x)))
|
||||
|
||||
(defn expand
|
||||
([datum]
|
||||
(expand
|
||||
|
||||
@@ -9,6 +9,15 @@
|
||||
(t/deftest symtable-for-env-test
|
||||
(t/is (s/valid? ::sut/symtable (sut/symtable-for-env sut/scheme-base-env))))
|
||||
|
||||
(t/deftest nearest-test
|
||||
(t/is (= [:primitive 'lambda]
|
||||
(sut/lookup ['lambda #{}]
|
||||
sut/scheme-base-env
|
||||
(sut/symtable-for-env sut/scheme-base-env))))
|
||||
(t/is (= [#{0 1}]
|
||||
(sut/nearest ['x #{0 1 2}]
|
||||
[#{0} #{0 1} #{0 3}]))))
|
||||
|
||||
(t/deftest expand-test
|
||||
(t/testing "unbound symbol"
|
||||
(t/is (thrown? Exception (sut/expand 'x))))
|
||||
|
||||
Reference in new issue
Block a user