build: omit named test source operands

This commit is contained in:
2026-08-22 21:53:10 +09:00
parent 3922f1c34e
commit 2e5451a601
13 changed files with 1666 additions and 21 deletions

View File

@@ -326,15 +326,38 @@ ImportPath = ident { "." ident } .
eligible. Only the requested basename participates: a hidden parent does not
hide visible `main.ww`, a hidden symlink spelling stays hidden for any
existing non-directory target, and a visible symlink spelling stays eligible.
The excluded operand creates no package, declaration, import binding/edge,
action, artifact, initialization, test,
publication, or persistent state. `ww build` reports the existing
`directory contains no WW package sources` condition; an explicit running
raw `ww test` also emits its command-owned `FAIL`, while `-c` and `-S` do not.
This rule does not add multiple named-source package support, does not change
visible `*_test.ww` handling, and does not apply to logical operands,
directory/recursive requests, imports, or `ww run`. The diagnostic parent is
presentation metadata and never canonical identity.
The prefix-excluded operand creates no package, declaration, import
binding/edge, action, artifact, initialization, test, publication, or
persistent state. `ww build` reports the existing `directory contains no WW
package sources` condition; an explicit running raw `ww test` also emits its
command-owned `FAIL`, while `-c` and `-S` do not.
- A visible single raw operand passed to `ww build` whose requested final
basename ends exactly `_test.ww` is test-only after its package clause and
contiguous initial import section have been read. Prefix exclusion remains
first, so a bare `_test.ww` is never opened. Header read, package-clause, and
initial-import syntax errors retain their ordinary precedence; after a valid
header the sole root is omitted. Its dotted imports are not resolved, and a
late import, body parse/type error, or runtime behavior is not observed. The
first ordinary body token is not lexed, so an immediately following malformed
UTF-8 byte or non-leading BOM is outside the header. A raw NUL reached while
locating that token and an unterminated comment in header trivia remain load
errors. Go's byte reader probes a following `i` as a possible `import`; the
corresponding WW boundary is the exact lexical `import` token, so an ordinary
WW identifier merely beginning with `i` is body syntax. This named-source
rule retains all-files platform behavior: a
visible `x_windows_test.ww` is still test-only. It classifies the requested
basename of a visible symlink, not its target name; a symlink whose target is
a directory remains a directory request.
- Omission creates no canonical package, command-line package node, import
binding or edge, graph/action, symbol, initializer, executable, archive,
interface, publication, transaction, default `.sepwork`, or work-state
mutation. It does not alter `ww test`, `ww test -c`, `ww test -S`, logical
operands, directory/recursive selection, multiple named-source support,
imports, or `ww run`. Physical directory and symlink-target data remain
observation metadata, never package, import, graph, action, artifact,
symbol, `.wwi`, publication, or persistence identity. Build workdir format
remains 18, test workdir format remains 19, and semantic storage format
remains 3.
- `import acme.codec;` loads the canonical package `acme.codec`. If that
package declares `package wire;`, the importing file sees its exported names
as `wire.Name`; `codec.Name` is not an additional binding. An explicit alias
@@ -467,6 +490,15 @@ ImportPath = ident { "." ident } .
Output paths and directory metadata never become package, import, graph, action,
symbol, artifact, `.wwi`, or persistence identity.
A valid omitted single raw `*_test.ww` build has an empty selection. With no
effective `-o`, including an assembly-only request, and with exact
`-o /dev/null`, it succeeds silently. A non-directory effective output fails
with `ww: no packages to build`; an output-directory effective output fails
with `ww: no main packages to build`. These empty-selection outcomes occur
only after the raw test source's header has loaded successfully, create no
output path or parent, and preserve every pre-existing output and work-state
byte unchanged.
Every caller-visible build installation checks its destination after all
applicable compile, assemble, archive, and link producers finish. Ordinary
`stat` follows symlinks. An existing directory rejects as