From 89bd4de1e2704c1bc562788b2c5e4fc08b71a538 Mon Sep 17 00:00:00 2001 From: Joel Martin Date: Wed, 23 Apr 2014 21:46:57 -0500 Subject: 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'. --- tests/step6_file.mal | 13 +++++++++++++ tests/stepA_more.mal | 18 +++++++++++++++--- 2 files changed, 28 insertions(+), 3 deletions(-) (limited to 'tests') 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] -- cgit v1.2.3