Add test for question in #285
This commit is contained in:
parent
117e1c7f64
commit
17c5e4b980
2 changed files with 16 additions and 1 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -12,6 +12,7 @@
|
||||||
.clj-kondo/.cache
|
.clj-kondo/.cache
|
||||||
.eastwood
|
.eastwood
|
||||||
.nrepl-port
|
.nrepl-port
|
||||||
|
.socket-repl-port
|
||||||
.classpath
|
.classpath
|
||||||
.project
|
.project
|
||||||
.nrepl-port
|
.nrepl-port
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,8 @@
|
||||||
(:refer-clojure :exclude [format])
|
(:refer-clojure :exclude [format])
|
||||||
(:require #?(:clj [clojure.test :refer [deftest is testing]]
|
(:require #?(:clj [clojure.test :refer [deftest is testing]]
|
||||||
:cljs [cljs.test :refer-macros [deftest is testing]])
|
:cljs [cljs.test :refer-macros [deftest is testing]])
|
||||||
[honey.sql :as sut :refer [format]]))
|
[honey.sql :as sut :refer [format]]
|
||||||
|
[honey.sql.helpers :as h]))
|
||||||
|
|
||||||
(deftest mysql-tests
|
(deftest mysql-tests
|
||||||
(is (= ["SELECT * FROM `table` WHERE `id` = ?" 1]
|
(is (= ["SELECT * FROM `table` WHERE `id` = ?" 1]
|
||||||
|
|
@ -525,3 +526,16 @@ DO UPDATE SET email = EXCLUDED.email || ';' || customers.email
|
||||||
:on-conflict :name
|
:on-conflict :name
|
||||||
:do-update-set {:email [:|| :EXCLUDED.email [:inline ";"] :customers.email]}}
|
:do-update-set {:email [:|| :EXCLUDED.email [:inline ";"] :customers.email]}}
|
||||||
{:pretty? true}))))
|
{:pretty? true}))))
|
||||||
|
|
||||||
|
(deftest issue-285
|
||||||
|
(is (= ["
|
||||||
|
SELECT *
|
||||||
|
FROM processes
|
||||||
|
WHERE state = ?
|
||||||
|
ORDER BY id = ? DESC
|
||||||
|
" 42 123]
|
||||||
|
(format (-> (h/select :*)
|
||||||
|
(h/from :processes)
|
||||||
|
(h/where [:= :state 42])
|
||||||
|
(h/order-by [[:= :id 123] :desc]))
|
||||||
|
{:pretty? true}))))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue