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
|
||||
.eastwood
|
||||
.nrepl-port
|
||||
.socket-repl-port
|
||||
.classpath
|
||||
.project
|
||||
.nrepl-port
|
||||
|
|
|
|||
|
|
@ -4,7 +4,8 @@
|
|||
(:refer-clojure :exclude [format])
|
||||
(:require #?(:clj [clojure.test :refer [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
|
||||
(is (= ["SELECT * FROM `table` WHERE `id` = ?" 1]
|
||||
|
|
@ -525,3 +526,16 @@ DO UPDATE SET email = EXCLUDED.email || ';' || customers.email
|
|||
:on-conflict :name
|
||||
:do-update-set {:email [:|| :EXCLUDED.email [:inline ";"] :customers.email]}}
|
||||
{: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