test: prove canonical directory test products
This commit is contained in:
42
docs/spec.md
42
docs/spec.md
@@ -251,10 +251,12 @@ ImportName = ident .
|
||||
ImportPath = ident { "." ident } .
|
||||
```
|
||||
|
||||
- Every source file begins with a package clause. A directory of eligible
|
||||
`.ww` files sharing one declared package name compiles as one package. The
|
||||
declared name need not equal the directory name or the final component of its
|
||||
canonical import identity.
|
||||
- Every source file begins with a package clause. Within one semantic source
|
||||
action, eligible `.ww` files share one declared package name. Ordinary
|
||||
production and same-package test sources use `p`; external test sources may
|
||||
use the related `p_test`, and the actions remain separate even though one
|
||||
canonical directory owns their test product. The declared name need not equal
|
||||
the directory name or the final component of its canonical import identity.
|
||||
- Directory source eligibility uses Go 1.26.5 filename suffix semantics for
|
||||
WW's fixed `linux/amd64` target. In the basename stem before the first dot, a
|
||||
final `_test` token is ignored for platform matching. A final known OS or
|
||||
@@ -286,10 +288,12 @@ ImportPath = ident { "." ident } .
|
||||
initialization. Repeated blank occurrences and blank plus default/explicit
|
||||
named occurrences of one path are valid; every named occurrence remains
|
||||
independently subject to duplicate-binding and unused checks.
|
||||
The package dependency graph is the sorted, deduplicated union of the real
|
||||
imports in all eligible files. Occurrences retain their owning file and
|
||||
position, but equal canonical targets create one graph edge/package action.
|
||||
Self-import is rejected.
|
||||
Each semantic action's package dependency graph is the sorted, deduplicated
|
||||
union of real imports in that action's eligible source set. Occurrences retain
|
||||
their owning file and position, but equal canonical targets create one graph
|
||||
edge. Test-only occurrences never enter ordinary production. Self-import is
|
||||
rejected, except that toolchain-owned external-test self wiring is rebound to
|
||||
the effective augmented package action after ordinary per-site validation.
|
||||
- An executable package is one declared `package main` and containing a
|
||||
`fn main`; path and directory spelling do not classify commands. An ordinary
|
||||
import of a package declared `main` is rejected, except for the toolchain's
|
||||
@@ -606,13 +610,21 @@ the program. Two placements, following the Go `foo` / `foo_test` model:
|
||||
```
|
||||
|
||||
Production, production-plus-white-box-test, external black-box-test, test
|
||||
support, and generated test main are distinct package actions. Before a test
|
||||
function runs, the generated test product initializes its exact reachable
|
||||
variant graph dependency-first and once per canonical action. A white-box
|
||||
variant replaces the colocated production task rather than initializing both;
|
||||
an external variant depends on ordinary production. Imports, runtime lets, and
|
||||
init declarations found only in `*_test.ww` never enter an ordinary production
|
||||
build.
|
||||
support, recompiled-for-test dependencies, and generated test main are distinct
|
||||
package actions. One canonical selected directory owns one test product and one
|
||||
generated main, which imports every applicable same-package and external target
|
||||
and produces one binary/result. The external action's import of the package
|
||||
under test binds to the augmented white-box action when it exists; affected
|
||||
transitive importers are copied and rewired so ordinary and augmented package
|
||||
state do not coexist in the linked closure.
|
||||
|
||||
Before a test function runs, the one generated product initializes its exact
|
||||
effective graph dependency-first and once per canonical action. Imports,
|
||||
runtime lets, and init declarations found only in `*_test.ww` never enter an
|
||||
ordinary production build. Test-only same-package, external-package, and valid
|
||||
mixed directories are accepted from their selected test files. A directory
|
||||
with no selected test file validates ordinary production but creates no test
|
||||
support, generated main, link, binary, result, or process.
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user