Skip to content

Commit

Permalink
Fixes #22: Boolean not supported by default
Browse files Browse the repository at this point in the history
  • Loading branch information
alaisi committed May 3, 2016
1 parent 7ecbf5c commit 049a508
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
:url "http://github.com/alaisi/postgres.async.git"}
:dependencies [[org.clojure/clojure "1.6.0"]
[org.clojure/core.async "0.2.374"]
[com.github.alaisi.pgasync/postgres-async-driver "0.7"]
[com.github.alaisi.pgasync/postgres-async-driver "0.8-SNAPSHOT"]
[cheshire "5.5.0" :scope "provided"]]
:lein-release {:deploy-via :clojars}
:global-vars {*warn-on-reflection* true}
Expand Down
12 changes: 10 additions & 2 deletions test/postgres/async_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@

(testing "query returns rows as map"
(let [rs (wait (query! *db* ["select 1 as x"]))]
(is (= 1 (get-in rs [0 :x]))))))
(is (= 1 (get-in rs [0 :x])))))

(testing "query returns oid bool as boolean"
(let [rs (wait (query! *db* ["select true as b"]))]
(is (= true (get-in rs [0 :b]))))))

(deftest query-for-array

Expand All @@ -50,7 +54,11 @@

(testing "nested arrays are converted to vectors"
(let [rs (wait (query! *db* ["select '{{1,2},{3,4},{5,NULL}}'::INT[][] as a"]))]
(is (= [[1 2] [3 4] [5 nil]] (get-in rs [0 :a]))))))
(is (= [[1 2] [3 4] [5 nil]] (get-in rs [0 :a])))))

(testing "bool arrays are converted to boolean vectors"
(let [rs (wait (query! *db* ["select '{true,false}'::BOOL[] as b"]))]
(is (= [true false] (get-in rs [0 :b]))))))

(deftest query-for-rows

Expand Down

0 comments on commit 049a508

Please sign in to comment.