adds tests for :union and :union-all

This commit is contained in:
Dave Della Costa 2015-08-26 00:11:29 +09:00
parent 22b0d15283
commit 2123c01fb5

View file

@ -53,3 +53,13 @@
:columns [:baz]
:values [[#sql/array ["one" "two" "three"]]]})
["INSERT INTO foo (baz) VALUES (ARRAY[?, ?, ?])" "one" "two" "three"])))
(deftest union-test
(is (= (format {:union [{:select [:foo] :from [:bar1]}
{:select [:foo] :from [:bar2]}]})
["(SELECT foo FROM bar1) UNION (SELECT foo FROM bar2)"])))
(deftest union-all-test
(is (= (format {:union-all [{:select [:foo] :from [:bar1]}
{:select [:foo] :from [:bar2]}]})
["(SELECT foo FROM bar1) UNION ALL (SELECT foo FROM bar2)"])))