From 173e0a8ab0d266f6efdc36aba47363aa9aecb3ef Mon Sep 17 00:00:00 2001 From: Leon Mergen Date: Thu, 9 Jun 2016 15:30:21 +0200 Subject: [PATCH] Adds test case for not-exists --- test/suricatta/dsl_test.clj | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/test/suricatta/dsl_test.clj b/test/suricatta/dsl_test.clj index 485baaa..a4a459a 100644 --- a/test/suricatta/dsl_test.clj +++ b/test/suricatta/dsl_test.clj @@ -271,7 +271,15 @@ (dsl/where ["table.author_id = author.id"])))))] (is (= (fmt/sql q) "select fullname from author where exists (select id from table where (table.author_id = author.id))")))) -) + + (testing "Nested select in where clause using not-exists" + (let [q (-> (dsl/select :fullname) + (dsl/from :author) + (dsl/where (dsl/not-exists (-> (dsl/select :id) + (dsl/from :table) + (dsl/where ["table.author_id = author.id"])))))] + (is (= (fmt/sql q) + "select fullname from author where not exists (select id from table where (table.author_id = author.id))"))))) (deftest dsl-insert (testing "Insert statement from values as maps"