Doc block testing now understands refer-clojure

Test-doc-blocks added support for this feature
This commit is contained in:
lread 2021-08-30 17:40:25 -04:00
parent 4eb9eca147
commit cccd3e96fd
5 changed files with 8 additions and 4 deletions

View file

@ -56,12 +56,13 @@ From Clojure:
From ClojureScript, we don't have `:refer :all`. If we want to use `:refer`, we have no choice but to be specific:
<!-- {:test-doc-blocks/reader-cond :cljs} -->
```Clojure
(refer-clojure :exclude '[filter for group-by into partition-by set update])
(require '[honey.sql :as sql]
'[honey.sql.helpers :refer [select select-distinct from
join left-join right-join
where for group-by having union
order-by limit offset values columns
insert-into set composite
update insert-into set composite
delete delete-from truncate] :as h]
'[clojure.core :as c])
```
@ -368,7 +369,7 @@ VALUES (?, (?, ?)), (?, (?, ?))
Updates are possible too:
```clojure
(-> (h/update :films)
(-> (update :films)
(set {:kind "dramatic"
:watched [:+ :watched 1]})
(where [:= :kind "drama"])
@ -655,7 +656,7 @@ If `<table(s)>` and `<qualifier>` are both omitted, you may also omit the `[`..`
(-> (select :foo.a)
(from :foo)
(where [:= :foo.a "baz"])
(h/for :update)
(for :update)
(sql/format))
=> ["SELECT foo.a FROM foo WHERE foo.a = ? FOR UPDATE" "baz"]
```

View file

@ -4,7 +4,7 @@
:aliases
{;; for help: clojure -A:deps -T:build help/doc
:build {:deps {babashka/fs {:mvn/version "0.0.5"}
com.github.lread/test-doc-blocks {:mvn/version "1.0.137-alpha"}
com.github.lread/test-doc-blocks {:mvn/version "1.0.146-alpha"}
io.github.seancorfield/build-clj {:git/tag "v0.1.0" :git/sha "fe2d586"}}
:ns-default build}

View file

@ -16,6 +16,7 @@ DDL clauses are listed first, followed by SQL clauses.
The examples herein assume:
```clojure
(refer-clojure :exclude '[partition-by])
(require '[honey.sql :as sql]
'[honey.sql.helpers :refer [select from join-by left-join join
where order-by over partition-by window]])

View file

@ -20,6 +20,7 @@ HoneySQL not to do that. There are two possible approaches:
The code example herein assume:
```clojure
(refer-clojure :exclude '[update set])
(require '[honey.sql :as sql]
'[honey.sql.helpers :refer [select from where
update set

View file

@ -124,6 +124,7 @@ There are helpers for both `filter` and `within-group`. Be careful with `filter`
since it shadows `clojure.core/filter`:
```clojure
(refer-clojure :exclude '[filter])
(require '[honey.sql.helpers :refer [select filter within-group from order-by where]])
(sql/format (-> (select :a :b [(filter :%count.* (where :< :x 100)) :c]