mirror of
https://github.com/kanaka/mal.git
synced 2024-10-26 14:22:25 +03:00
step 1: Test reading some simple nested collections.
These tests are intended to catch the cases where the routine for reading a list, vector, or hashmap fails to consume the trailing token (')', ']', or '}' as the case may be) from the input. None of the existing step 1 tests detected this, and I only found it by playing around in the REPL.
This commit is contained in:
parent
eacb46df65
commit
beeffb021c
@ -50,6 +50,8 @@ abc-def
|
||||
;=>(** 1 2)
|
||||
(* -3 6)
|
||||
;=>(* -3 6)
|
||||
(()())
|
||||
;=>(() ())
|
||||
|
||||
;; Test commas as whitespace
|
||||
(1 2, 3,,,,),,
|
||||
@ -139,6 +141,8 @@ false
|
||||
;=>[+ 1 [+ 2 3]]
|
||||
[ + 1 [+ 2 3 ] ]
|
||||
;=>[+ 1 [+ 2 3]]
|
||||
([])
|
||||
;=>([])
|
||||
|
||||
;; Testing read of hash maps
|
||||
{}
|
||||
@ -155,6 +159,8 @@ false
|
||||
;=>{"a" {"b" {"cde" 3}}}
|
||||
{ :a {:b { :cde 3 } }}
|
||||
;=>{:a {:b {:cde 3}}}
|
||||
({})
|
||||
;=>({})
|
||||
|
||||
;; Testing read of comments
|
||||
;; whole line comment (not an exception)
|
||||
|
Loading…
Reference in New Issue
Block a user