X-Git-Url: http://git.hcoop.net/jackhill/mal.git/blobdiff_plain/1771ab50b87c745181e4e30f94b63e3f23d33dac..f522319598c701efde91a78b07110d7039a8c906:/tests/step1_read_print.mal diff --git a/tests/step1_read_print.mal b/tests/step1_read_print.mal index 2b7c2692..4ac08cb0 100644 --- a/tests/step1_read_print.mal +++ b/tests/step1_read_print.mal @@ -51,6 +51,49 @@ abc-def ;=>(+ 1 (+ 2 3)) ( + 1 (+ 2 3 ) ) ;=>(+ 1 (+ 2 3)) +(* 1 2) +;=>(* 1 2) +(** 1 2) +;=>(** 1 2) + +;; Test commas as whitespace +(1 2, 3,,,,),, +;=>(1 2 3) + +;; Testing read of quoting +'1 +;=>(quote 1) +'(1 2 3) +;=>(quote (1 2 3)) +`1 +;=>(quasiquote 1) +`(1 2 3) +;=>(quasiquote (1 2 3)) +~1 +;=>(unquote 1) +~(1 2 3) +;=>(unquote (1 2 3)) +~@(1 2 3) +;=>(splice-unquote (1 2 3)) + +;; +;; Testing reader errors +;;; TODO: fix these so they fail correctly +(1 2 +; expected ')', got EOF +[1 2 +; expected ']', got EOF +"abc +; expected '"', got EOF + +;; +;; -------- Optional Functionality -------- + +;; Testing keywords +:kw +;=>:kw +(:kw1 :kw2 :kw3) +;=>(:kw1 :kw2 :kw3) ;; Testing read of vectors [+ 1 2] @@ -71,23 +114,7 @@ abc-def ;=>{"a" {"b" {"c" 3}}} { "a" {"b" { "cde" 3 } }} ;=>{"a" {"b" {"cde" 3}}} - -;; Test commas as whitespace -(1 2, 3,,,,),, -;=>(1 2 3) - -;; -;; Testing reader errors -;;; TODO: fix these so they fail correctly -(1 2 -; expected ')', got EOF -[1 2 -; expected ']', got EOF -"abc -; expected '"', got EOF - -;; -;; -------- Optional Functionality -------- +;=>{:a {:b {:cde 3}}} ;; Testing read of comments ;; whole line comment (not an exception) @@ -96,23 +123,6 @@ abc-def 1; comment after expression ;=>1 -;; Testing read of quoting -'1 -;=>(quote 1) -'(1 2 3) -;=>(quote (1 2 3)) -`1 -;=>(quasiquote 1) -`(1 2 3) -;=>(quasiquote (1 2 3)) -~1 -;=>(unquote 1) -~(1 2 3) -;=>(unquote (1 2 3)) -~@(1 2 3) -;=>(splice-unquote (1 2 3)) - - ;; Testing read of ^/metadata ^{"a" 1} [1 2 3] ;=>(with-meta [1 2 3] {"a" 1})