clojure.test/are substitutes via clojure.template
are let-bound its template vars, so a var inside quote never substituted: (are [x] (special-symbol? 'x) if def) tested the literal symbol x twice. Rebuild are on clojure.template/do-template (postwalk substitution), the same architecture as upstream, with the same arg-count check. This un-aborts every suite namespace whose are rows need substitution: cts baseline moves 5302->5614 pass, 236->192 errors, 88->84 baselined namespaces. The newly-reachable assertions also surface real divergences now baselined and filed (edn reader strictness, Boolean ctor).
This commit is contained in:
parent
53a8aac2d0
commit
86e36e8bee
4 changed files with 61 additions and 21 deletions
|
|
@ -196,6 +196,42 @@ cases; clojure-test-suite `core_test/parse_uuid.cljc`,
|
|||
|
||||
---
|
||||
|
||||
### clojure.template/apply-template, clojure.test/are — since 1.1
|
||||
|
||||
```
|
||||
(apply-template argv expr values)
|
||||
(are argv expr & args)
|
||||
```
|
||||
|
||||
**Semantics**
|
||||
|
||||
- S1. `apply-template` MUST replace every occurrence of each `argv` symbol
|
||||
in `expr` with its corresponding value by structural walk (postwalk symbol
|
||||
substitution), not by lexical binding. Occurrences inside `quote` and at
|
||||
any nesting depth substitute: `(apply-template '[x] '(f 'x) '[if])` ⇒
|
||||
`(f 'if)`.
|
||||
- S2. `do-template` MUST partition `args` by `(count argv)` and expand to a
|
||||
`do` of one substituted `expr` per group.
|
||||
- S3. `clojure.test/are` MUST expand through `do-template` with `expr`
|
||||
wrapped in `is`. Consequently `(are [x] (special-symbol? 'x) if def)`
|
||||
asserts `(special-symbol? 'if)` and `(special-symbol? 'def)` — a
|
||||
let-binding implementation is non-conforming (the quoted symbol would not
|
||||
substitute).
|
||||
|
||||
**Errors**
|
||||
|
||||
- X1. `are` MUST throw at macroexpansion when `(count args)` is not a
|
||||
positive multiple of a non-empty `(count argv)` (empty/empty is allowed).
|
||||
- X2. `apply-template` MUST throw when `argv` is not a vector of symbols.
|
||||
|
||||
**Conformance**
|
||||
|
||||
S1–S3 → `test/chez/clojure-test.clj` (are with quoted template var);
|
||||
clojure-test-suite `core_test/special_symbol_qmark.cljc` and every
|
||||
`are`-based suite namespace.
|
||||
|
||||
---
|
||||
|
||||
## Authoring notes
|
||||
|
||||
- Source examples from the ClojureDocs export (`clojuredocs-export.edn`,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue