From d1115c8c427464a28dd5827c90fe35c582abbc72 Mon Sep 17 00:00:00 2001 From: Sean Corfield Date: Mon, 17 Mar 2025 17:23:12 -0700 Subject: [PATCH] switch quoted tests to core lazytest dsl Signed-off-by: Sean Corfield --- test/next/jdbc/quoted_test.clj | 42 +++++++++++++++------------------- 1 file changed, 19 insertions(+), 23 deletions(-) diff --git a/test/next/jdbc/quoted_test.clj b/test/next/jdbc/quoted_test.clj index 2a0d0cb..c005751 100644 --- a/test/next/jdbc/quoted_test.clj +++ b/test/next/jdbc/quoted_test.clj @@ -3,32 +3,28 @@ (ns next.jdbc.quoted-test "Basic tests for quoting strategies. These are also tested indirectly 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 schema]])) (set! *warn-on-reflection* true) -(deftest basic-quoting - (are [quote-fn quoted] (= (quote-fn "x") quoted) - ansi "\"x\"" - mysql "`x`" - sql-server "[x]" - oracle "\"x\"" - postgres "\"x\"")) +(def ^:private quote-fns [ansi mysql sql-server oracle postgres]) -(deftest schema-quoting - (testing "verify non-schema behavior" - (are [quote-fn quoted] (= (quote-fn "x.y") quoted) - ansi "\"x.y\"" - mysql "`x.y`" - sql-server "[x.y]" - oracle "\"x.y\"" - postgres "\"x.y\"")) - (testing "verify schema behavior" - (are [quote-fn quoted] (= ((schema quote-fn) "x.y") quoted) - ansi "\"x\".\"y\"" - mysql "`x`.`y`" - sql-server "[x].[y]" - oracle "\"x\".\"y\"" - postgres "\"x\".\"y\""))) +(defdescribe quoted-functionality + (describe "base quoting" + (it "should correctly quote simple names" + (doseq [[f e] (map vector quote-fns + ["\"x\"" "`x`" "[x]" "\"x\"" "\"x\""])] + (expect (= (f "x") e))))) + (describe "dotted name quoting" + (describe "basic quoting" + (it "should quote dotted names 'as-is'" + (doseq [[f e] (map vector quote-fns + ["\"x.y\"" "`x.y`" "[x.y]" "\"x.y\"" "\"x.y\""])] + (expect (= (f "x.y") e))))) + (describe "schema quoting" + (it "should split and quote dotted names with schema" + (doseq [[f e] (map vector quote-fns + ["\"x\".\"y\"" "`x`.`y`" "[x].[y]" "\"x\".\"y\"" "\"x\".\"y\""])] + (expect (= ((schema f) "x.y") e)))))))