Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added test for quasiquote

  • Loading branch information...
commit 994625ca106eb4b56ff6c34c278d3c51d337e0e4 1 parent ff21967
@athos authored
Showing with 33 additions and 0 deletions.
  1. +33 −0 test/syntactic_closure/test/quasiquote.clj
View
33 test/syntactic_closure/test/quasiquote.clj
@@ -0,0 +1,33 @@
+(ns syntactic-closure.test.quasiquote
+ (:use [syntactic-closure.core :only [qq]]
+ [clojure.test :only [deftest is]]))
+
+(def x 101)
+(def xs [102 103 104])
+
+(deftest quasiquote
+ (is (= (qq ())
+ '()))
+ (is (= (qq ~x)
+ 101))
+ (is (= (qq (0 1 2))
+ '(0 1 2)))
+ (is (= (qq (0 ~x 2))
+ '(0 101 2)))
+ (is (= (qq (~x))
+ '(101)))
+ (is (= (qq (1 ~@xs 5))
+ '(1 102 103 104 5)))
+ (is (= (qq (~@xs))
+ '(102 103 104)))
+ (is (= (qq [1 ~@xs 5])
+ [1 102 103 104 5]))
+ (is (= (qq {0 1 ~@xs 5})
+ {0 1 102 103 104 5}))
+ (is (= (qq (0 (qq (~x ~@xs))))
+ '(0 (qq (~x ~@xs)))))
+ (is (= (qq (0 (qq ~'(~x ~@xs))))
+ '(0 (qq (clojure.core/unquote (quote (101 102 103 104)))))))
+ (is (= (qq (0 (qq (~~x ~~@xs))))
+ '(0 (qq ((clojure.core/unquote 101)
+ (clojure.core/unquote (clojure.core/unquote-splicing xs))))))))
Please sign in to comment.
Something went wrong with that request. Please try again.