From fdfb0697ec9fba6dd9f111514b6b75956d406e33 Mon Sep 17 00:00:00 2001 From: Sean Corfield Date: Wed, 29 May 2019 09:04:21 -0700 Subject: [PATCH] Address #24 by setting warn on reflection in tests This highlights the reflection on `.close` (in the connection tests). --- src/next/jdbc/quoted.clj | 2 ++ src/next/jdbc/specs.clj | 2 ++ src/next/jdbc/sql.clj | 2 ++ test/next/jdbc/connection_test.clj | 2 ++ test/next/jdbc/optional_test.clj | 2 ++ test/next/jdbc/prepare_test.clj | 2 ++ test/next/jdbc/protocols_test.clj | 2 ++ test/next/jdbc/quoted_test.clj | 2 ++ test/next/jdbc/result_set_test.clj | 2 ++ test/next/jdbc/specs_test.clj | 2 ++ test/next/jdbc/sql_test.clj | 2 ++ test/next/jdbc/test_fixtures.clj | 2 ++ test/next/jdbc/transaction_test.clj | 2 ++ test/next/jdbc_test.clj | 2 ++ 14 files changed, 28 insertions(+) diff --git a/src/next/jdbc/quoted.clj b/src/next/jdbc/quoted.clj index 1e5cdc7..598354a 100644 --- a/src/next/jdbc/quoted.clj +++ b/src/next/jdbc/quoted.clj @@ -6,6 +6,8 @@ from Clojure data." (:require [clojure.string :as str])) +(set! *warn-on-reflection* true) + (defn ansi "ANSI \"quoting\"" [s] (str \" s \")) (defn mysql "MySQL `quoting`" [s] (str \` s \`)) diff --git a/src/next/jdbc/specs.clj b/src/next/jdbc/specs.clj index 80cda5b..2c08ceb 100644 --- a/src/next/jdbc/specs.clj +++ b/src/next/jdbc/specs.clj @@ -19,6 +19,8 @@ (:import (java.sql Connection PreparedStatement) (javax.sql DataSource))) +(set! *warn-on-reflection* true) + (s/def ::dbtype string?) (s/def ::dbname string?) (s/def ::classname string?) diff --git a/src/next/jdbc/sql.clj b/src/next/jdbc/sql.clj index ba7deb9..7958bbb 100644 --- a/src/next/jdbc/sql.clj +++ b/src/next/jdbc/sql.clj @@ -22,6 +22,8 @@ (:require [clojure.string :as str] [next.jdbc :refer [execute! execute-one!]])) +(set! *warn-on-reflection* true) + (defn- by-keys "Given a hash map of column names and values and a clause type (`:set`, `:where`), return a vector of a SQL clause and its parameters. diff --git a/test/next/jdbc/connection_test.clj b/test/next/jdbc/connection_test.clj index e4809e6..4b36862 100644 --- a/test/next/jdbc/connection_test.clj +++ b/test/next/jdbc/connection_test.clj @@ -11,6 +11,8 @@ [next.jdbc.connection :as c] [next.jdbc.protocols :as p])) +(set! *warn-on-reflection* true) + (def ^:private db-name "clojure_test") (deftest test-aliases-and-defaults diff --git a/test/next/jdbc/optional_test.clj b/test/next/jdbc/optional_test.clj index 8ba85fa..6d218d1 100644 --- a/test/next/jdbc/optional_test.clj +++ b/test/next/jdbc/optional_test.clj @@ -8,6 +8,8 @@ [next.jdbc.protocols :as p] [next.jdbc.test-fixtures :refer [with-test-db ds]])) +(set! *warn-on-reflection* true) + (use-fixtures :once with-test-db) (deftest test-map-row-builder diff --git a/test/next/jdbc/prepare_test.clj b/test/next/jdbc/prepare_test.clj index daa6850..3703332 100644 --- a/test/next/jdbc/prepare_test.clj +++ b/test/next/jdbc/prepare_test.clj @@ -9,3 +9,5 @@ actually work they way they're supposed to!" (:require [clojure.test :refer [deftest is testing]] [next.jdbc.prepare :refer :all])) + +(set! *warn-on-reflection* true) diff --git a/test/next/jdbc/protocols_test.clj b/test/next/jdbc/protocols_test.clj index b177726..b5be805 100644 --- a/test/next/jdbc/protocols_test.clj +++ b/test/next/jdbc/protocols_test.clj @@ -5,3 +5,5 @@ at this level tho'..." (:require [clojure.test :refer [deftest is testing]] [next.jdbc.protocols :refer :all])) + +(set! *warn-on-reflection* true) diff --git a/test/next/jdbc/quoted_test.clj b/test/next/jdbc/quoted_test.clj index 0c52762..e62babb 100644 --- a/test/next/jdbc/quoted_test.clj +++ b/test/next/jdbc/quoted_test.clj @@ -7,6 +7,8 @@ [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\"" diff --git a/test/next/jdbc/result_set_test.clj b/test/next/jdbc/result_set_test.clj index 802007f..a01b7ac 100644 --- a/test/next/jdbc/result_set_test.clj +++ b/test/next/jdbc/result_set_test.clj @@ -14,6 +14,8 @@ [next.jdbc.test-fixtures :refer [with-test-db ds]]) (:import (java.sql ResultSet ResultSetMetaData))) +(set! *warn-on-reflection* true) + (use-fixtures :once with-test-db) (deftest test-datafy-nav diff --git a/test/next/jdbc/specs_test.clj b/test/next/jdbc/specs_test.clj index 19cdee5..56d92f4 100644 --- a/test/next/jdbc/specs_test.clj +++ b/test/next/jdbc/specs_test.clj @@ -7,3 +7,5 @@ next.jdbc and next.jdbc.sql namespaces." (:require [clojure.test :refer [deftest is testing]] [next.jdbc.specs :refer :all])) + +(set! *warn-on-reflection* true) diff --git a/test/next/jdbc/sql_test.clj b/test/next/jdbc/sql_test.clj index fa43136..d211436 100644 --- a/test/next/jdbc/sql_test.clj +++ b/test/next/jdbc/sql_test.clj @@ -11,6 +11,8 @@ [next.jdbc.test-fixtures :refer [with-test-db ds derby? sqlite?]])) +(set! *warn-on-reflection* true) + (use-fixtures :once with-test-db) (specs/instrument) diff --git a/test/next/jdbc/test_fixtures.clj b/test/next/jdbc/test_fixtures.clj index a304114..d4e19f8 100644 --- a/test/next/jdbc/test_fixtures.clj +++ b/test/next/jdbc/test_fixtures.clj @@ -5,6 +5,8 @@ (:require [next.jdbc :as jdbc] [next.jdbc.sql :as sql])) +(set! *warn-on-reflection* true) + (def ^:private test-derby {:dbtype "derby" :dbname "clojure_test_derby" :create true}) (def ^:private test-h2-mem {:dbtype "h2:mem" :dbname "clojure_test_h2_mem"}) diff --git a/test/next/jdbc/transaction_test.clj b/test/next/jdbc/transaction_test.clj index 96b8395..c817ba3 100644 --- a/test/next/jdbc/transaction_test.clj +++ b/test/next/jdbc/transaction_test.clj @@ -4,3 +4,5 @@ "Stub test namespace for transaction handling." (:require [clojure.test :refer [deftest is testing]] [next.jdbc.transaction :refer :all])) + +(set! *warn-on-reflection* true) diff --git a/test/next/jdbc_test.clj b/test/next/jdbc_test.clj index dd39527..ac0baff 100644 --- a/test/next/jdbc_test.clj +++ b/test/next/jdbc_test.clj @@ -10,6 +10,8 @@ [next.jdbc.specs :as specs]) (:import (java.sql ResultSet ResultSetMetaData))) +(set! *warn-on-reflection* true) + (use-fixtures :once with-test-db) (specs/instrument)