From f939ae95444fd3d4caef2e23e4fd54c56a5ab3ab Mon Sep 17 00:00:00 2001 From: Nicolas Dandrimont Date: Tue, 14 May 2013 12:10:29 +0200 Subject: [PATCH] Test quoting dicts --- tests/native_tests/quote.hy | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/native_tests/quote.hy b/tests/native_tests/quote.hy index 0b64f3d..f180a98 100644 --- a/tests/native_tests/quote.hy +++ b/tests/native_tests/quote.hy @@ -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)))