Skip to content

Commit 0a572eb

Browse files
committed
check that all passing values are placed in right order
1 parent 6d282d4 commit 0a572eb

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

test/honeysql_postgres/postgres_test.cljc

+13-13
Original file line numberDiff line numberDiff line change
@@ -340,34 +340,34 @@
340340
:quoting :ansi))))))
341341

342342
(deftest case-when-test
343-
(is (= ["CASE WHEN x = 1 THEN x WHEN x > 1 THEN y END"]
344-
(-> (case-when [:= :x (sql/inline 1)] :x
345-
[:> :x (sql/inline 1)] :y)
343+
(is (= ["CASE WHEN x = ? THEN x WHEN x > ? THEN y END" 1 2]
344+
(-> (case-when [:= :x 1] :x
345+
[:> :x 2] :y)
346346
sql/format))))
347347

348348
(deftest case-when-else-test
349-
(is (= ["CASE WHEN x = 1 THEN x WHEN x > 1 THEN y ELSE z END"]
350-
(-> (case-when-else [:= :x (sql/inline 1)] :x
351-
[:> :x (sql/inline 1)] :y
352-
:z)
349+
(is (= ["CASE WHEN x = ? THEN x WHEN x > ? THEN y ELSE ? END" 1 2 5]
350+
(-> (case-when-else [:= :x 1] :x
351+
[:> :x 2] :y
352+
5)
353353
sql/format))))
354354

355355
(deftest join-lateral-test
356-
(is (= ["SELECT count(x3), count(x0) FROM x_values INNER JOIN LATERAL (SELECT (CASE WHEN x > 3 THEN x END) AS x3, (CASE WHEN x > 0 THEN x END) AS x0) z ON true"]
356+
(is (= ["SELECT count(x3), count(x0) FROM x_values INNER JOIN LATERAL (SELECT (CASE WHEN x > ? THEN x END) AS x3, (CASE WHEN x > ? THEN x END) AS x0) z ON true" 3 0]
357357
(-> (select :%count.x3
358358
:%count.x0)
359359
(from :x-values)
360360
(join-lateral [(select
361-
[(case-when [:> :x (sql/inline 3)] :x) :x3]
362-
[(case-when [:> :x (sql/inline 0)] :x) :x0]) :z] :true)
361+
[(case-when [:> :x 3] :x) :x3]
362+
[(case-when [:> :x 0] :x) :x0]) :z] :true)
363363
sql/format))))
364364

365365
(deftest left-join-lateral-test
366-
(is (= ["SELECT count(x3), count(x0) FROM x_values LEFT JOIN LATERAL (SELECT (CASE WHEN x > 3 THEN x END) AS x3, (CASE WHEN x > 0 THEN x END) AS x0) z ON true"]
366+
(is (= ["SELECT count(x3), count(x0) FROM x_values LEFT JOIN LATERAL (SELECT (CASE WHEN x > ? THEN x END) AS x3, (CASE WHEN x > ? THEN x END) AS x0) z ON true" 3 0]
367367
(-> (select :%count.x3
368368
:%count.x0)
369369
(from :x-values)
370370
(left-join-lateral [(select
371-
[(case-when [:> :x (sql/inline 3)] :x) :x3]
372-
[(case-when [:> :x (sql/inline 0)] :x) :x0]) :z] :true)
371+
[(case-when [:> :x 3] :x) :x3]
372+
[(case-when [:> :x 0] :x) :x0]) :z] :true)
373373
sql/format))))

0 commit comments

Comments
 (0)