From 2e8157047dac02dba49a8b079736a32916f0085d Mon Sep 17 00:00:00 2001 From: Sean Corfield Date: Sun, 3 Dec 2023 17:17:28 -0800 Subject: [PATCH] add test for #515 --- test/honey/sql_test.cljc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/honey/sql_test.cljc b/test/honey/sql_test.cljc index c7544e3..df52f92 100644 --- a/test/honey/sql_test.cljc +++ b/test/honey/sql_test.cljc @@ -1293,6 +1293,22 @@ ORDER BY id = ? DESC (is (= ["SELECT DISTINCT * FROM table"] (sut/format {:select ^:distinct [:*] :from [:table]}))))) +(deftest issue-515 + (testing ":always-quoting option" + (is (= ["SELECT foo FROM table"] + (sut/format '{select foo from table}))) + (is (= ["SELECT \"foo\" FROM \"table\""] + (sut/format '{select foo from table} + {:quoted-always #"^(foo|table)$"}))) + (is (= ["SELECT \"foo\" FROM \"table\""] + (sut/format '{select foo from table} + {:quoted-always #"^(foo|table)$" + :quoted false}))) + (is (= ["SELECT \"foo\" FROM table"] + (sut/format '{select foo from table} + {:quoted-always #"^(foo)$" + :quoted false}))))) + (comment ;; partial workaround for #407: (sut/format {:select :f.* :from [[:foo [:f :for :system-time]]] :where [:= :f.id 1]})