summaryrefslogtreecommitdiff
path: root/test/clojure_sql
diff options
context:
space:
mode:
Diffstat (limited to 'test/clojure_sql')
-rw-r--r--test/clojure_sql/core_test.clj22
1 files changed, 18 insertions, 4 deletions
diff --git a/test/clojure_sql/core_test.clj b/test/clojure_sql/core_test.clj
index d6654cf..b5d65e7 100644
--- a/test/clojure_sql/core_test.clj
+++ b/test/clojure_sql/core_test.clj
@@ -3,9 +3,23 @@
(:require [clojure-sql.core :refer :all]
[midje.sweet :refer :all]))
-#_(fact
- (compile-query nil (table :user))
+(fact
+ @(table :user)
=> ["SELECT * FROM \"user\""]
+
+ @(-> (table :user) (select '(= :username "george")))
+ => ["SELECT * FROM \"user\" WHERE (\"user\".\"username\" = ?)" "george"]
- (compile-query nil (-> (table :user) (select '(= :username "george"))))
- => ["SELECT * FROM \"user\" WHERE (\"user\".\"username\" = ?)" "george"])
+ @(-> (table :user) (project {:username :u}))
+ => ["SELECT \"user\".\"username\" AS \"u\" FROM \"user\""]
+
+ @(-> (table :user) (project {'(+ :username :password) :u}))
+ => ["SELECT (\"user\".\"username\" + \"user\".\"password\") AS \"u\" FROM \"user\""])
+
+(into {} (-> (table :user) (project '{(+ :username :password) :u})))
+
+(-> (table {(-> (table :users)
+ (project '[:username (+ 1 2 3)])
+ (rename '{(+ 1 2 3) :x})
+ (select `(exists ~(table :users)))) :u})
+ println)