Test quoting dicts
This commit is contained in:
parent
3252af3129
commit
f939ae9544
@ -1,3 +1,6 @@
|
|||||||
|
(import hy)
|
||||||
|
|
||||||
|
|
||||||
(defn test-quote []
|
(defn test-quote []
|
||||||
"NATIVE: test for quoting functionality"
|
"NATIVE: test for quoting functionality"
|
||||||
(setf q (quote (a b c)))
|
(setf q (quote (a b c)))
|
||||||
@ -21,6 +24,25 @@
|
|||||||
(assert (= (cdr q1) (quote (a b c)))))
|
(assert (= (cdr q1) (quote (a b c)))))
|
||||||
|
|
||||||
|
|
||||||
|
(defn test-quote-dicts []
|
||||||
|
"NATIVE: test quoting dicts"
|
||||||
|
(setf q (quote {foo bar baz quux}))
|
||||||
|
(assert (= (len q) 4))
|
||||||
|
(assert (= (get q 0) (quote foo)))
|
||||||
|
(assert (= (get q 1) (quote bar)))
|
||||||
|
(assert (= (get q 2) (quote baz)))
|
||||||
|
(assert (= (get q 3) (quote quux)))
|
||||||
|
(assert (= (type q) hy.HyDict)))
|
||||||
|
|
||||||
|
|
||||||
|
(defn test-quote-expr-in-dict []
|
||||||
|
"NATIVE: test quoting nested exprs in dict"
|
||||||
|
(setf q (quote {(foo bar) 0}))
|
||||||
|
(assert (= (len q) 2))
|
||||||
|
(setf qq (get q 0))
|
||||||
|
(assert (= qq (quote (foo bar)))))
|
||||||
|
|
||||||
|
|
||||||
(defn test-quasiquote []
|
(defn test-quasiquote []
|
||||||
"NATIVE: test that quasiquote and quote are equivalent for simple cases"
|
"NATIVE: test that quasiquote and quote are equivalent for simple cases"
|
||||||
(setf q (quote (a b c)))
|
(setf q (quote (a b c)))
|
||||||
|
Loading…
Reference in New Issue
Block a user