diff options
author | Carlo Zancanaro <carlo@clearboxsystems.com.au> | 2013-05-14 12:55:28 +1000 |
---|---|---|
committer | Carlo Zancanaro <carlo@clearboxsystems.com.au> | 2013-05-14 12:55:28 +1000 |
commit | a9c32acfd2a160d82a1c0c0f8484ddd202126b95 (patch) | |
tree | 23a3c1a392a2eb1195dae3312e403977e7ec5ebd /test/clojure_sql/core_test.clj | |
parent | 1c5a0359f7b048ad01a25607661229e13b5a6be7 (diff) |
Parametrise deref behaviour, add two small tests.
Now a user can decide what the query's behaviour on deref should be. This means
a user using jdbc can plug in with
(set-query-deref-behaviour! #(... jdbc-query-code-here ...))
if they want, but if a user wants to use the code for something else then they
can do so without needing to import jdbc stuff. (I'll admit I'm not sure what
else they'd do with it, but that's slightly beside the point.) Still left to do
is to provide a helper for the common case (performing an SQL query with jdbc).
Diffstat (limited to 'test/clojure_sql/core_test.clj')
-rw-r--r-- | test/clojure_sql/core_test.clj | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/clojure_sql/core_test.clj b/test/clojure_sql/core_test.clj new file mode 100644 index 0000000..1161ece --- /dev/null +++ b/test/clojure_sql/core_test.clj @@ -0,0 +1,11 @@ +(ns clojure-sql.core-test + (:refer-clojure :exclude [sort-by]) + (:require [clojure-sql.core :refer :all] + [midje.sweet :refer :all])) + +(fact + (compile-query nil (table :user)) + => ["SELECT * FROM \"user\""] + + (compile-query nil (-> (table :user) (select '(= :username "george")))) + => ["SELECT * FROM \"user\" WHERE (\"user\".\"username\" = ?)" "george"]) |