fixes #552 by turning the assertion into a test

Signed-off-by: Sean Corfield <sean@corfield.org>
This commit is contained in:
Sean Corfield 2024-11-22 15:25:52 -08:00
parent c0c455358f
commit e2f7991ad8
No known key found for this signature in database
3 changed files with 20 additions and 15 deletions

View file

@ -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.

View file

@ -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)

View file

@ -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 :*)