restore function call test using sql/call

This commit is contained in:
Michael Blume 2017-07-18 13:45:12 -07:00
parent a0b73cdcc6
commit 9ab7d3a2f8

View file

@ -115,6 +115,13 @@
:order-by [[:amount :asc]]})
["SELECT amount, id, created_on FROM transactions UNION SELECT amount, id, created_on FROM (SELECT amount, id, created_on FROM other_transactions ORDER BY amount DESC LIMIT ?) ORDER BY amount ASC" 5]))))
(deftest compare-expressions-test
(testing "sql/call should produce appropriate function calls"
(is (= ["SELECT foo FROM bar WHERE (col1 mod ?) = (col2 + ?)" 4 4]
(format {:select [:foo]
:from [:bar]
:where (sql/call := (sql/call :mod :col1 4) (sql/call :+ :col2 4))})))))
(deftest union-with-cte
(is (= (format {:union [{:select [:foo] :from [:bar1]}
{:select [:foo] :from [:bar2]}]