C#: add metadata and atoms.
[jackhill/mal.git] / tests / step1_read_print.mal
CommitLineData
31690700
JM
1;; Testing read of comments
2 ;; whole line comment (not an exception)
31 ; comment after expression
4;=>1
51; comment after expression
6;=>1
7
8
9;; Testing read of nil/true/false
10nil
11;=>nil
12true
13;=>true
14false
15;=>false
16
17
18;; Testing read of numbers
191
20;=>1
217
22;=>7
23 7
24;=>7
25
26
27;; Testing read of symbols
28+
29;=>+
30abc
31;=>abc
32 abc
33;=>abc
34abc5
35;=>abc5
36abc-def
37;=>abc-def
38
39
40;; Testing read of strings
41"abc"
42;=>"abc"
43 "abc"
44;=>"abc"
45"abc (with parens)"
46;=>"abc (with parens)"
47"abc\"def"
48;=>"abc\"def"
49;;;"abc\ndef"
50;;;;=>"abc\ndef"
51
52
53;; Testing read of lists
54(+ 1 2)
55;=>(+ 1 2)
56((3 4))
57;=>((3 4))
58(+ 1 (+ 2 3))
59;=>(+ 1 (+ 2 3))
60 ( + 1 (+ 2 3 ) )
61;=>(+ 1 (+ 2 3))
62
31690700
JM
63;; Testing read of vectors
64[+ 1 2]
65;=>[+ 1 2]
66[[3 4]]
67;=>[[3 4]]
68[+ 1 [+ 2 3]]
69;=>[+ 1 [+ 2 3]]
70 [ + 1 [+ 2 3 ] ]
71;=>[+ 1 [+ 2 3]]
72
31690700
JM
73;; Testing read of hash maps
74{"abc" 1}
75;=>{"abc" 1}
76{"a" {"b" 2}}
77;=>{"a" {"b" 2}}
78{"a" {"b" {"c" 3}}}
79;=>{"a" {"b" {"c" 3}}}
80{ "a" {"b" { "cde" 3 } }}
81;=>{"a" {"b" {"cde" 3}}}
82
83
84;; Testing read of quoting
85'1
86;=>(quote 1)
87'(1 2 3)
88;=>(quote (1 2 3))
89`1
90;=>(quasiquote 1)
91`(1 2 3)
92;=>(quasiquote (1 2 3))
93~1
94;=>(unquote 1)
95~(1 2 3)
96;=>(unquote (1 2 3))
97~@(1 2 3)
98;=>(splice-unquote (1 2 3))
99
100
101;; Testing read of ^/metadata
102^{"a" 1} [1 2 3]
103;=>(with-meta [1 2 3] {"a" 1})
104
105
106;; Testing read of @/deref
107@a
108;=>(deref a)
109
aef93ea3
JM
110;;
111;; Testing reader errors
112(1 2
113; expected ')', got EOF
114[1 2
115; expected ']', got EOF
116"abc
117; expected '"', got EOF