All: swap step9,A. Fixes for bash, C, perl.
[jackhill/mal.git] / tests / step7_quote.mal
CommitLineData
31690700
JM
1;; Testing regular quote
2(quote 7)
3;=>7
4'7
5;=>7
6(quote (1 2 3))
7;=>(1 2 3)
8'(1 2 3)
9;=>(1 2 3)
10(quote (1 2 (3 4)))
11;=>(1 2 (3 4))
12'(1 2 (3 4))
13;=>(1 2 (3 4))
14
15
16;; Testing simple quasiquote
17(quasiquote 7)
18;=>7
19`7
20;=>7
21(quasiquote (1 2 3))
22;=>(1 2 3)
23`(1 2 3)
24;=>(1 2 3)
25(quasiquote (1 2 (3 4)))
26;=>(1 2 (3 4))
27`(1 2 (3 4))
28;=>(1 2 (3 4))
29
30
31;; Testing unquote
32`~7
33;=>7
34(def! a 8)
35;=>8
36`a
37;=>a
38`~a
39;=>8
40`(1 a 3)
41;=>(1 a 3)
42`(1 ~a 3)
43;=>(1 8 3)
44(def! b '(1 "b" "d"))
45;=>(1 "b" "d")
46`(1 b 3)
47;=>(1 b 3)
48`(1 ~b 3)
49;=>(1 (1 "b" "d") 3)
db4c329a
JM
50;;; TODO: fix this
51;;;`[1 ~b 3]
52;;;;=>[1 (1 "b" "d") 3]
31690700
JM
53
54
55;; Testing splice-unquote
56(def! c '(1 "b" "d"))
57;=>(1 "b" "d")
58`(1 c 3)
59;=>(1 c 3)
60`(1 ~@c 3)
61;=>(1 1 "b" "d" 3)
db4c329a
JM
62;;; TODO: fix this
63;;;`[1 ~@c 3]
64;;;;=>[1 1 "b" "d" 3]
31690700
JM
65
66
67;; Testing symbol equality
68(= 'abc 'abc)
69;=>true
70(= 'abc 'abcd)
71;=>false
72(= 'abc "abc")
73;=>false
74(= "abc" 'abc)
75;=>false
1771ab50
JM
76
77;;;;; Test quine
78;;; TODO: needs expect line length fix
79;;;((fn* [q] (quasiquote ((unquote q) (quote (unquote q))))) (quote (fn* [q] (quasiquote ((unquote q) (quote (unquote q)))))))
80;;;=>((fn* [q] (quasiquote ((unquote q) (quote (unquote q))))) (quote (fn* [q] (quasiquote ((unquote q) (quote (unquote q)))))))