aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJoel Martin <github@martintribe.org>2014-10-27 23:20:22 -0500
committerJoel Martin <github@martintribe.org>2015-01-06 21:59:01 -0600
commit77b2da6cf337bbd85914619bfbccba69b6621a04 (patch)
treeafa9bcca8e965363962d585f312cb76eb14f8183 /tests
parentbd3067230dcbd18fb1f0db7abb52c4ea1c2e227b (diff)
downloadmal-77b2da6cf337bbd85914619bfbccba69b6621a04.tar.gz
mal-77b2da6cf337bbd85914619bfbccba69b6621a04.zip
rust: add conj, stepA. Self-hosting!
Diffstat (limited to 'tests')
-rw-r--r--tests/step8_macros.mal66
-rw-r--r--tests/step9_try.mal9
2 files changed, 42 insertions, 33 deletions
diff --git a/tests/step8_macros.mal b/tests/step8_macros.mal
index 8940a89..3f398d3 100644
--- a/tests/step8_macros.mal
+++ b/tests/step8_macros.mal
@@ -58,6 +58,39 @@
(unless2 true 7 8)
;=>8
+;; Testing or macro
+(or)
+;=>nil
+(or 1)
+;=>1
+(or 1 2 3 4)
+;=>1
+(or false 2)
+;=>2
+(or false nil 3)
+;=>3
+(or false nil false false nil 4)
+;=>4
+(or false nil 3 false nil 4)
+;=>3
+
+;; Testing cond macro
+
+(cond)
+;=>nil
+(cond true 7)
+;=>7
+(cond true 7 true 8)
+;=>7
+(cond false 7 true 8)
+;=>8
+(cond false 7 false 8 "else" 9)
+;=>9
+(cond false 7 (= 2 2) 8 "else" 9)
+;=>8
+(cond false 7 false 8 false 9)
+;=>nil
+
;; Testing macroexpand
(macroexpand (unless2 2 3 4))
;=>(if (not 2) 3 4)
@@ -82,22 +115,6 @@
(and 1 2 3 4 false 5)
;=>false
-;; Testing or macro
-(or)
-;=>nil
-(or 1)
-;=>1
-(or 1 2 3 4)
-;=>1
-(or false 2)
-;=>2
-(or false nil 3)
-;=>3
-(or false nil false false nil 4)
-;=>4
-(or false nil 3 false nil 4)
-;=>3
-
;; Testing -> macro
(-> 7)
@@ -111,23 +128,6 @@
(-> (list 7 8 9) rest (rest) first (+ 7))
;=>16
-;; Testing cond macro
-
-(cond)
-;=>nil
-(cond true 7)
-;=>7
-(cond true 7 true 8)
-;=>7
-(cond false 7 true 8)
-;=>8
-(cond false 7 false 8 "else" 9)
-;=>9
-(cond false 7 (= 2 2) 8 "else" 9)
-;=>8
-(cond false 7 false 8 false 9)
-;=>nil
-
;; Testing EVAL in let*
(let* (x (or nil "yes")) x)
diff --git a/tests/step9_try.mal b/tests/step9_try.mal
index b068355..3905274 100644
--- a/tests/step9_try.mal
+++ b/tests/step9_try.mal
@@ -156,9 +156,18 @@
(contains? hm2 "a")
;=>true
+
+;;; TODO: fix. Clojure returns nil but this breaks mal impl
+(keys hm1)
+;=>()
+
(keys hm2)
;=>("a")
+;;; TODO: fix. Clojure returns nil but this breaks mal impl
+(vals hm1)
+;=>()
+
(vals hm2)
;=>(1)