From a9c32acfd2a160d82a1c0c0f8484ddd202126b95 Mon Sep 17 00:00:00 2001 From: Carlo Zancanaro Date: Tue, 14 May 2013 12:55:28 +1000 Subject: 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). --- test/clojure_sql/core_test.clj | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 test/clojure_sql/core_test.clj (limited to 'test/clojure_sql/core_test.clj') 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"]) -- cgit v1.2.3