Commit graph

1039 commits

Author SHA1 Message Date
Sean Corfield
c81d27a224 Switch to build-clj lib 2021-08-27 22:51:49 -07:00
lread
35c5aee584 Test code blocks in docs with test-doc-blocks
Resolves #290

**Build**

New commands:
- `gen-doc-tests` - only regenerates tests if stale,
   use `clean` command to force regen
- `run-doc-tests` - calls gen-doc-tests then runs tests,
  accepts the same parameters as run-tests.
  Can specify `:platform`
    - `:cljs` - run tests under ClojureScript
    - otherwise Clojure where we can specify one of: `:1.9`
    `:1.10` `:master`

I'm not sure if my use of the `:platform` parameter jives with
your `:aliases` parameter used for `run-tests`.
Can adjust if you like.

Example usages:
```shell
clojure -T:build gen-doc-tests

clojure -T:build run-doc-tests :platform :cljs

clojure -T:build run-doc-tests

clojure -T:build run-doc-tests :platform :1.10
```

The `ci` command has been updated to generate and run doc tests for same
platforms as unit tests.

**Articles**

In addition to `README.md`, now testing doc blocks in all articles
under `doc` dir excepting `doc/operator-reference.md` which does not
have any runnable code blocks.

**Skipped**

Any code block that is intentionally not runnable has been marked to be
skipped via: `<!-- :test-doc-blocks/skip -->`.

**Consistency**

I noticed that some code blocks use REPL syntax:
```Clojure
user=> (+ 1 2 3)
6
```
and others use editor syntax:
```Clojure
(+ 1 2 3)
;;=> 6
```
some places also omit the comment for editor style:
```Clojure
(+ 1 2 3)
=> 6
```
All of this is just fine with test-doc-blocks.
I left the inconsistency as is, but can make a pass for consistency upon
request.

**HoneySQL state**

I noticed a code block that set the sql dialect was affecting other
tests. I simply restored the dialect to the default at the end of the
code block.

**Un-tweaked output**

Some code blocks had string output hand-tweaked for readability.
These have been adjusted to instead use `sql/format`'s `:pretty` option.
In some cases the output is not as readable as the hand-tweaked version.
I humbly suggest that perhaps `:pretty` output could perhaps be
improved (instead of having test-doc-blocks somehow adapt).

**Corrections**

There were very few code blocks that required fixing due to incorrect
output/code.  Please review the diffs carefully to make sure all is as
expected.

**refer-clojure :excludes**

Not currently supported for test-doc-blocks, not a real issue for
Clojure, we'll see warnings under Clojure, but that's probably ok.

But I might actually need it for ClojureScript.
I was finding that `for` did not get overridden by our helper
`:refer` in CloureScript.

Will add proper support to test-doc-blocks but in the short-term,
will use `h/for`.

**ns requires adjustments**

Any specific case of `(ns my-ns (require [my-require :as a]))` is now
the REPL friendly `(require '[my-require :as a])`

Any missing required `requires` were added.

The HoneySQL docs seem to encourage the use of referred vars for
helpers. Although this has the con of overlaps with Clojure core vars,
it is also convenient for Clojure when using `:refer :all`.

**ClojureScript :refer**

ClojureScript does not support `:refer :all` and each var must be
specified in place of `:all`.

I have adjusted examples accordingly to work with both Clojure and
ClojureScript.
2021-08-27 18:39:07 -04:00
Sean Corfield
584cd1c711 update tools.build; add deploy via build 2021-08-22 19:30:04 -07:00
Sean Corfield
5246fe4549 Clean up prebuild 2021-08-18 08:31:31 -07:00
Sean Corfield
943b9547c9 Add Open in Gitpod badge/link 2021-08-17 22:49:43 -07:00
Sean Corfield
eac5e933c3 Fix runner/build/gitpod REPL 2021-08-17 22:39:07 -07:00
Sean Corfield
ee65201cfc prep for 2.0 Gold (2.0.783) 2021-08-15 11:27:09 -07:00
Sean Corfield
68a1ccfa3c Bump tools.build; write scm>tag 2021-08-13 16:10:45 -07:00
Sean Corfield
68eafc0c2e clean up :deploy 2021-08-12 19:43:16 -07:00
Sean Corfield
5f68b8ca77 add build alias to cache 2021-08-12 19:24:24 -07:00
Sean Corfield
4ba9d2f6ca fix cljs test alias 2021-08-12 19:21:35 -07:00
Sean Corfield
5191abaa6c switch to tools.build 2021-08-12 19:20:02 -07:00
Sean Corfield
dabb501e4b fix typos in readme 2021-08-12 18:34:18 -07:00
Sean Corfield
9ece8972b5 fixes #344 by special-casing MySQL SET 2021-08-12 18:26:39 -07:00
Sean Corfield
249ab639ec Add links to HoneySQL web app 2021-08-06 11:35:53 -07:00
Sean Corfield
aef6e4cba7 fix cache setup 1.9/1.10 2021-07-31 19:37:22 -07:00
Sean Corfield
e51637008d update change log 2021-07-29 23:23:29 -07:00
Sean Corfield
97c42f5c78 does circleci have 1.10.3.933 yet? 2021-07-29 23:09:56 -07:00
Sean Corfield
964f9837b0 version bumps 2021-07-29 23:00:02 -07:00
Sean Corfield
10e6e755e9 fixes #340 2021-07-22 19:49:25 -07:00
Sean Corfield
3288ee7ec5 Update changelog to reflect doc changes 2021-07-18 19:02:19 -07:00
Sean Corfield
4480c9c1c7 Merge branch 'develop' of github.com:seancorfield/honeysql into develop 2021-07-18 16:36:15 -07:00
Sean Corfield
904af73505 Fixes #339 by calling out param/lift for JSON usage 2021-07-18 16:36:11 -07:00
Sean Corfield
3680a1beae Address #332 by improving select docs 2021-07-17 18:59:26 -07:00
Sean Corfield
13044d7394 fix/improve limit, offset, fetch docs 2021-07-17 18:49:11 -07:00
Sean Corfield
01c3a555ba prep for RC 5(!) 2021-07-17 18:00:02 -07:00
Sean Corfield
50bbfef07f Fixes #338 properly by making offset/fetch smarter 2021-07-17 17:57:17 -07:00
Sean Corfield
52e2a57fca Fix fetch helper 2021-07-17 16:51:34 -07:00
Sean Corfield
1836c7bcf1 Address #332 by improving :cross-join docs 2021-07-17 14:49:18 -07:00
Sean Corfield
679a0309db prep for 2.0.0-rc4 2021-07-17 14:25:55 -07:00
Sean Corfield
7e84b58463 fixes #338 by adding ONLY to :fetch 2021-07-17 13:32:43 -07:00
Sean Corfield
994f166d40 Merge branch 'develop' of github.com:seancorfield/honeysql into develop 2021-07-15 19:27:05 -07:00
Sean Corfield
a393cd89e2 fixes #337 by using clojure.test for cljs 2021-07-15 19:26:59 -07:00
Sean Corfield
8387dad01a
Merge pull request #336 from pinealan/remove-dup-doc
Remove duplicate docs example of insert clause
2021-07-10 15:11:42 -07:00
Alan Chan
fa5c45e985 Remove duplicate example of insert clause 2021-07-10 14:10:23 +08:00
Sean Corfield
98e94ada67 Cleanup .gitignore 2021-07-09 16:19:47 -07:00
Sean Corfield
616543c35d Update CI 2021-06-21 15:35:57 -07:00
Sean Corfield
1b2e742b38 Reflect revert of CI changes 2021-06-21 15:26:23 -07:00
Sean Corfield
1aec4c3e35 Revert run-tests.sh changes 2021-06-21 15:24:30 -07:00
Sean Corfield
14a3dea831 Revert shellcheck #331 2021-06-21 15:22:53 -07:00
Sean Corfield
8d159391c0 Accept parts of #331 2021-06-21 15:20:41 -07:00
Sean Corfield
395ba6a5bd Address #334 in part by correcting :arglist 2021-06-21 15:17:04 -07:00
Sean Corfield
8ec08ca686 Addresses #331 by changing some CI stuff
* Updated Eastwood to 0.5.1
* Added set -Eeo pipefail to run-tests.sh (I don't like -x)
* Run CI on PR
* Add shellcheck to steps

I'm not going to run Eastwood on tests at this point (see my
comments in #334 for reasons).
2021-06-21 15:16:18 -07:00
Sean Corfield
13b640d486 Note with-columns bug fix 2021-06-21 14:51:45 -07:00
Sean Corfield
1c2f1f4a99 Merge branch 'develop' of github.com:seancorfield/honeysql into develop 2021-06-21 14:50:58 -07:00
Sean Corfield
b32911d808 Fix bug in unrolling with-columns args 2021-06-21 14:50:55 -07:00
Sean Corfield
4324ed4250
Merge pull request #333 from john-shaffer/bcm-multi-join
Add multiple join to big complicated map example.
2021-06-18 20:33:29 -07:00
John Shaffer
d89cdb52d5 Add multiple join to big complicated map example. 2021-06-18 21:43:01 -05:00
Sean Corfield
cf136c2fdc cljs/1.9 compatibility 2021-06-17 13:05:49 -07:00
Sean Corfield
00b20f6bbf Address #330 by improving exception 2021-06-17 12:54:15 -07:00