diff --git a/CHANGELOG.md b/CHANGELOG.md index 68adfa9..7988c50 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ * 2.6.next in progress * Fix [#553](https://github.com/seancorfield/honeysql/issues/553) by adding `:not-between` as special syntax via PR [#554](https://github.com/seancorfield/honeysql/pull/554) [@plooney81](https://github.com/plooney81) + * Fix [#552](https://github.com/seancorfield/honeysql/issues/552) by changing the assert-on-load behavior into an explicit test in the test suite. * Fix [#551](https://github.com/seancorfield/honeysql/issues/551) by supporting multiple `WINDOW` clauses. * Fix [#549](https://github.com/seancorfield/honeysql/issues/549) by using `:bb` conditionals to support Babashka (and still support Clojure 1.9.0), and add testing against Babashka so it is fully-supported as a target via PR [#550](https://github.com/seancorfield/honeysql/pull/550) [@borkdude](https://github.com/borkdude) * Address [#532](https://github.com/seancorfield/honeysql/issues/532) by adding support for `EXCLUDE` and `RENAME` and starting to write tests for XTDB compatibility. diff --git a/src/honey/sql/helpers.cljc b/src/honey/sql/helpers.cljc index 0f51c1d..680a33d 100644 --- a/src/honey/sql/helpers.cljc +++ b/src/honey/sql/helpers.cljc @@ -1186,20 +1186,6 @@ [k args] (generic-1 k args)) -#?(:clj - (do - ;; #409 this assert is only valid when :doc metadata is not elided: - (when (-> #'generic-helper-unary meta :doc) - ;; ensure #295 stays true (all public functions have docstring): - (assert (empty? (->> (ns-publics *ns*) (vals) (c/filter (comp not :doc meta)))))) - ;; ensure all public functions match clauses: - (assert (= (c/set (conj @#'honey.sql/default-clause-order - :composite :filter :lateral :over :within-group - :upsert - :generic-helper-variadic :generic-helper-unary)) - (c/set (conj (map keyword (keys (ns-publics *ns*))) - :nest :raw)))))) - (comment (-> (delete-from :table) (where [:in (composite :first :second) diff --git a/test/honey/sql/helpers_test.cljc b/test/honey/sql/helpers_test.cljc index 1e7c92c..62bf953 100644 --- a/test/honey/sql/helpers_test.cljc +++ b/test/honey/sql/helpers_test.cljc @@ -2,7 +2,8 @@ (ns honey.sql.helpers-test (:refer-clojure :exclude [filter for group-by partition-by set update]) - (:require [clojure.test :refer [deftest is testing]] + (:require [clojure.core :as c] + [clojure.test :refer [deftest is testing]] [honey.sql :as sql] [honey.sql.helpers :as h :refer [add-column add-index alter-table columns create-table create-table-as create-view @@ -20,6 +21,23 @@ values where window with with-columns with-data within-group]])) +#?(:clj + (deftest helpers-are-complete + (let [helpers-ns (find-ns 'honey.sql.helpers)] + (testing "all public helpers have docstrings" + ;; #409 this assert is only valid when :doc metadata is not elided: + (when (-> #'h/generic-helper-unary meta :doc) + ;; ensure #295 stays true (all public functions have docstring): + (is (= [] (->> (ns-publics helpers-ns) (vals) (c/filter (comp not :doc meta))))))) + (testing "all clauses have public helpers" + ;; ensure all public functions match clauses: + (is (= (c/set (conj @#'honey.sql/default-clause-order + :composite :filter :lateral :over :within-group + :upsert + :generic-helper-variadic :generic-helper-unary)) + (c/set (conj (map keyword (keys (ns-publics helpers-ns))) + :nest :raw)))))))) + (deftest test-select (testing "large helper expression" (let [m1 (-> (with [:cte (-> (select :*)