switch quoted tests to core lazytest dsl

Signed-off-by: Sean Corfield <sean@corfield.org>
This commit is contained in:
Sean Corfield 2025-03-17 17:23:12 -07:00
parent 60503dac03
commit d1115c8c42
No known key found for this signature in database

View file

@ -3,32 +3,28 @@
(ns next.jdbc.quoted-test (ns next.jdbc.quoted-test
"Basic tests for quoting strategies. These are also tested indirectly "Basic tests for quoting strategies. These are also tested indirectly
via the next.jdbc.sql tests." via the next.jdbc.sql tests."
(:require [lazytest.experimental.interfaces.clojure-test :refer [deftest are testing]] (:require [lazytest.core :refer [defdescribe describe it expect]]
[next.jdbc.quoted :refer [ansi mysql sql-server oracle postgres [next.jdbc.quoted :refer [ansi mysql sql-server oracle postgres
schema]])) schema]]))
(set! *warn-on-reflection* true) (set! *warn-on-reflection* true)
(deftest basic-quoting (def ^:private quote-fns [ansi mysql sql-server oracle postgres])
(are [quote-fn quoted] (= (quote-fn "x") quoted)
ansi "\"x\""
mysql "`x`"
sql-server "[x]"
oracle "\"x\""
postgres "\"x\""))
(deftest schema-quoting (defdescribe quoted-functionality
(testing "verify non-schema behavior" (describe "base quoting"
(are [quote-fn quoted] (= (quote-fn "x.y") quoted) (it "should correctly quote simple names"
ansi "\"x.y\"" (doseq [[f e] (map vector quote-fns
mysql "`x.y`" ["\"x\"" "`x`" "[x]" "\"x\"" "\"x\""])]
sql-server "[x.y]" (expect (= (f "x") e)))))
oracle "\"x.y\"" (describe "dotted name quoting"
postgres "\"x.y\"")) (describe "basic quoting"
(testing "verify schema behavior" (it "should quote dotted names 'as-is'"
(are [quote-fn quoted] (= ((schema quote-fn) "x.y") quoted) (doseq [[f e] (map vector quote-fns
ansi "\"x\".\"y\"" ["\"x.y\"" "`x.y`" "[x.y]" "\"x.y\"" "\"x.y\""])]
mysql "`x`.`y`" (expect (= (f "x.y") e)))))
sql-server "[x].[y]" (describe "schema quoting"
oracle "\"x\".\"y\"" (it "should split and quote dotted names with schema"
postgres "\"x\".\"y\""))) (doseq [[f e] (map vector quote-fns
["\"x\".\"y\"" "`x`.`y`" "[x].[y]" "\"x\".\"y\"" "\"x\".\"y\""])]
(expect (= ((schema f) "x.y") e)))))))