Fix macros test; add test for zip

There were some errors in the call to Dyanmic.map. I've fixed those!
I've also added a test for zip.
This commit is contained in:
scottolsen 2020-04-20 11:24:04 -04:00
parent ba0bfe7ed7
commit 1602e49320

View File

@ -59,10 +59,15 @@
(list 'let (array x 1) (list '= x 1))))
(defmacro test-map []
(let [mapped (Dynamic.map length '(a) '(b c) '(d e f))]
(let [mapped (Dynamic.map length '((a) (b c) (d e f)))]
(Dynamic.and (Dynamic.and (= 1 (Dynamic.car mapped)) (= 2 (Dynamic.cadr mapped))) (= 3
(Dynamic.caddr mapped)))))
(defmacro test-zip []
(let [zipped (Dynamic.zip array '('a 'd) '('c 'o) '('e 'g))]
(Dynamic.and (= 'ace (Symbol.join (eval (Dynamic.car zipped))))
(= 'dog (Symbol.join (eval (Dynamic.cadr zipped)))))))
(deftest test
(assert-true test
(test-let-do)
@ -229,4 +234,7 @@
(assert-true test
(test-map)
"map works as expected")
(assert-true test
(test-zip)
"zip works as expected")
)