aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJoel Martin <github@martintribe.org>2014-11-03 20:32:46 -0600
committerJoel Martin <github@martintribe.org>2015-01-09 16:16:44 -0600
commit8128c69a1da03d3b8d62defb4533c3e3ae706682 (patch)
treec005e9b22c1a851dbea727a127173011b94ec04a /tests
parentc30efef469e22c8ba345a72c058c28362e57b746 (diff)
downloadmal-8128c69a1da03d3b8d62defb4533c3e3ae706682.tar.gz
mal-8128c69a1da03d3b8d62defb4533c3e3ae706682.zip
R: add step8_macros and step9_try.
Diffstat (limited to 'tests')
-rw-r--r--tests/step7_quote.mal10
-rw-r--r--tests/step8_macros.mal19
-rw-r--r--tests/step9_try.mal8
3 files changed, 25 insertions, 12 deletions
diff --git a/tests/step7_quote.mal b/tests/step7_quote.mal
index a8771bf..dae6cbd 100644
--- a/tests/step7_quote.mal
+++ b/tests/step7_quote.mal
@@ -99,6 +99,15 @@
;;
;; -------- Optional Functionality --------
+;; Testing cons, concat, first, rest with vectors
+
+(cons [1] [2 3])
+;=>([1] 2 3)
+(cons 1 [2 3])
+;=>(1 2 3)
+(concat [1 2] (list 3 4) [5 6])
+;=>(1 2 3 4 5 6)
+
;; Testing unquote with vectors
(def! a 8)
;=>8
@@ -114,3 +123,4 @@
;=>(1 1 "b" "d" 3)
;;; TODO: fix this
;;;;=>[1 1 "b" "d" 3]
+
diff --git a/tests/step8_macros.mal b/tests/step8_macros.mal
index 6564eae..93f3ea9 100644
--- a/tests/step8_macros.mal
+++ b/tests/step8_macros.mal
@@ -114,14 +114,17 @@
;;
;; -------- Optional Functionality --------
-;; Testing cons, concat, first, rest with vectors
-
-(cons [1] [2 3])
-;=>([1] 2 3)
-(cons 1 [2 3])
-;=>(1 2 3)
-(concat [1 2] (list 3 4) [5 6])
-;=>(1 2 3 4 5 6)
+;; Testing nth, first, rest with vectors
+
+(nth [] 0)
+;=>nil
+(nth [1] 0)
+;=>1
+(nth [1 2] 1)
+;=>2
+(nth [1 2] 2)
+;=>nil
+
(first [])
;=>nil
(first [10])
diff --git a/tests/step9_try.mal b/tests/step9_try.mal
index 3905274..f5bcb58 100644
--- a/tests/step9_try.mal
+++ b/tests/step9_try.mal
@@ -6,12 +6,12 @@
;=>nil
;;;TODO: fix so long lines don't trigger ANSI escape codes ;;;(try*
-;;;(try* (throw {"data" "foo"}) (catch* exc (do (prn "exc is:" exc) 7))) ;;;;
-;;;; "exc is:" {"data" "foo"} ;;;;=>7
+;;;(try* (throw ["data" "foo"]) (catch* exc (do (prn "exc is:" exc) 7))) ;;;;
+;;;; "exc is:" ["data" "foo"] ;;;;=>7
;;;;=>7
-(try* (throw {"data" "foo"}) (catch* exc (do (prn "err:" exc) 7)))
-; "err:" {"data" "foo"}
+(try* (throw ["data" "foo"]) (catch* exc (do (prn "err:" exc) 7)))
+; "err:" ["data" "foo"]
;=>7
(try* (throw "my exception") (catch* exc (do (prn "exc:" exc) 7)))