Test quoting dicts

This commit is contained in:
Nicolas Dandrimont 2013-05-14 12:10:29 +02:00
parent 3252af3129
commit f939ae9544

View File

@ -1,3 +1,6 @@
(import hy)
(defn test-quote []
"NATIVE: test for quoting functionality"
(setf q (quote (a b c)))
@ -21,6 +24,25 @@
(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 []
"NATIVE: test that quasiquote and quote are equivalent for simple cases"
(setf q (quote (a b c)))