Commit graph

28 commits

Author SHA1 Message Date
Sean Corfield
1710e07231 fix #486 by support ansi/postgresl interval 2023-04-13 22:46:37 -07:00
Sean Corfield
8cbb7f3834 address #483 by adding tests & docs for :join 2023-04-07 11:42:39 -07:00
Sean Corfield
ece9be3a4b prep for 2.4.1006 2023-03-17 15:38:08 -07:00
Sean Corfield
3c65999ef1 fix #474 by documenting dot-selection
and adding support for two levels of field/column selection
2023-03-03 15:26:22 -08:00
Eugene Pakhomov
0c7642a357 Add optional type argument to the :array special 2023-02-28 02:04:05 +02:00
Youngil Choi
a87fa0c9ab Improve type formatting logic in :cast function 2022-11-20 06:51:43 +09:00
Sean Corfield
737699c11a fix #425 by clarifying MySQL vs PostgreSQL 2022-09-01 22:23:33 -07:00
Sean Corfield
f0ada59fff fix #406 2022-07-29 15:41:04 -07:00
Sean Corfield
13a8aa11b2 skip the example that throws 2022-04-23 14:11:19 -07:00
Sean Corfield
7f8b7a79b1 addresses #403: improve error message; improve docs 2022-04-23 13:40:34 -07:00
Sean Corfield
8a2f447676 Fix #382 by adding :case-expr syntax 2022-01-29 17:19:17 -08:00
Sean Corfield
b30aa0f3f9 fix #375 2021-12-21 22:54:02 -08:00
Sean Corfield
be1df97b2b fix #371 2021-11-26 22:30:36 -08:00
lread
cccd3e96fd Doc block testing now understands refer-clojure
Test-doc-blocks added support for this feature
2021-08-30 17:40:25 -04: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
a51cfe5a2e Fixes #328 by adding :distinct special syntax 2021-06-12 18:15:59 -07:00
Sean Corfield
50fd829752 Addresses #310 by adding filter, order-by, within-group syntax 2021-04-11 14:32:48 -07:00
Sean Corfield
8f7c990eed Complete special syntax docs 2021-04-09 17:23:39 -07:00
Sean Corfield
fd84864279 Fixes #161 by adding :raw clause support 2021-03-15 14:48:28 -07:00
Sean Corfield
cff1e5b43c Fixes #284 by adding lateral expression syntax 2021-03-13 13:13:35 -08:00
Sean Corfield
d35d9141bc Fixes #280 by adding [:escape pattern chars] 2021-03-12 15:39:54 -08:00
Sean Corfield
ddebda9481 Fixes #301 Fixes #306 by expanding drop/create syntax 2021-03-12 11:43:21 -08:00
Sean Corfield
26741450e6 Note relation between :lift and honeysql.format/value 2021-02-14 14:00:28 -08:00
Sean Corfield
4b7ded4009 WIP nilenso test (fails) 2021-02-13 10:50:36 -08:00
Sean Corfield
41ed38ea38 Finish and document DDL 2021-02-12 21:50:22 -08:00
Sean Corfield
e157aec976 Addresses #293 by adding over, partition-by, and window 2021-02-10 16:25:31 -08:00
Sean Corfield
1d2b8e8203 Document special syntax 2021-02-02 16:43:09 -08:00
Sean Corfield
ea0bfbabc1 Outline of docs for clauses, operators, and special syntax 2021-02-02 14:50:12 -08:00