aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJoel Martin <github@martintribe.org>2014-04-23 21:46:57 -0500
committerJoel Martin <github@martintribe.org>2014-04-23 21:46:57 -0500
commit89bd4de1e2704c1bc562788b2c5e4fc08b71a538 (patch)
tree3ec33ca7e1030fdef0905317fdf911b8487685f0 /tests
parent85cc53f35b8302e13f0014454ac320b971c196db (diff)
downloadmal-89bd4de1e2704c1bc562788b2c5e4fc08b71a538.tar.gz
mal-89bd4de1e2704c1bc562788b2c5e4fc08b71a538.zip
Perl: add vector, hash-map, metadata, atom support. TCO let*
- Changes all collections to be one level of inderection where the top level is always a hash containing 'meta' and 'val'.
Diffstat (limited to 'tests')
-rw-r--r--tests/step6_file.mal13
-rw-r--r--tests/stepA_more.mal18
2 files changed, 28 insertions, 3 deletions
diff --git a/tests/step6_file.mal b/tests/step6_file.mal
index 1f4f756..8198391 100644
--- a/tests/step6_file.mal
+++ b/tests/step6_file.mal
@@ -1,3 +1,16 @@
+;; Testing read-string, eval and slurp
+
+(read-string "(+ 2 3)")
+;=>(+ 2 3)
+
+(eval (read-string "(+ 2 3)"))
+;=>5
+
+;;; TODO: fix newline matching so that this works
+;;;(slurp "../tests/test.txt")
+;;;;=>"A line of text\n"
+
+
;; Testing load-file
(load-file "../tests/inc.mal")
diff --git a/tests/stepA_more.mal b/tests/stepA_more.mal
index 4d2acf9..0378c58 100644
--- a/tests/stepA_more.mal
+++ b/tests/stepA_more.mal
@@ -66,6 +66,12 @@
(read-string "(1 2 (3 4) nil)")
;=>(1 2 (3 4) nil)
+(read-string "7 ;; comment")
+;=>7
+
+(read-string ";; comment")
+;=>nil
+
(eval (read-string "(+ 4 5)"))
;=>9
@@ -91,6 +97,15 @@
(sequential? "abc")
;=>false
+;; Testing vector functions
+
+(vector? [10 11])
+;=>true
+(vector? '(12 13))
+;=>false
+(vector 3 4 5)
+;=>[3 4 5]
+
;; Testing conj function
(conj (list) 1)
;=>(1)
@@ -198,9 +213,6 @@
(meta (fn* (a) a))
;=>nil
-(meta +)
-;=>nil
-
(with-meta [1 2 3] {"a" 1})
;=>[1 2 3]