ww: test sources are *_test.ww only (Go contract)

Go compiles only _test.go files as tests; discovery now keys on the
_test.ww suffix alone. The line-leading-@test compatibility allowance
(noncanonical filenames admitted as test sources) is removed from both
driver stages and the coordinator. An @test declaration outside a
*_test.ww file is rejected loudly ("@test declaration outside
*_test.ww", wording byte-identical cs/ww) instead of silently running
under compose or silently dropping in a non-T build (#6). Tree audit
found zero real carriers; the two allowance fixtures flip canonical
(dep_test.ww, widget_test.ww). New pins: direnum attest-noncanon
reject row (both-stage stderr parity) and the coordinator
noncanonical_attest_rejected package row.
This commit is contained in:
2026-08-08 20:38:02 +09:00
parent 0cf9643be8
commit 659e859f34
10 changed files with 109 additions and 47 deletions

View File

@@ -24,8 +24,9 @@ package direnum_test;
// rejects — the authoritative loader-reject table over private trees:
// root-conflict ("conflicting package names"), import-leaf ("does
// not match import path"), root-missing and root-invalid ("invalid
// or missing package clause"); per row both stages fail, carry the
// needle, and their captured stderr is byte-identical.
// or missing package clause"), attest-noncanon ("@test declaration
// outside *_test.ww" — Go's test-file contract); per row both stages
// fail, carry the needle, and their captured stderr is byte-identical.
//
// Dropped C machinery, not assertions: the ww_ww-absent skip gate
// (the Make target declares both drivers) and the unlink/rmdir
@@ -164,11 +165,13 @@ fn rejectpair(label: str, td: str, target: str, needle: str) void = {
let wanted: str = strings.concat(importbad, "/wanted");
let missing: str = strings.concat(td, "/missing");
let invalid: str = strings.concat(td, "/invalid");
let attbad: str = strings.concat(td, "/attbad");
assert(os.mkdir(rootbad, 493) == 0);
assert(os.mkdir(importbad, 493) == 0);
assert(os.mkdir(wanted, 493) == 0);
assert(os.mkdir(missing, 493) == 0);
assert(os.mkdir(invalid, 493) == 0);
assert(os.mkdir(attbad, 493) == 0);
testenv.writefile(strings.concat(rootbad, "/a.ww"),
"package rootbad;\nfn main() i32 = { return 0; };\n");
testenv.writefile(strings.concat(rootbad, "/b.ww"),
@@ -182,15 +185,21 @@ fn rejectpair(label: str, td: str, target: str, needle: str) void = {
"fn main() i32 = { return 0; };\n");
testenv.writefile(strings.concat(invalid, "/a.ww"),
"package 7bad;\nfn main() i32 = { return 0; };\n");
testenv.writefile(strings.concat(attbad, "/a.ww"),
"package attbad;\nfn main() i32 = { return 0; };\n");
testenv.writefile(strings.concat(attbad, "/t.ww"), strings.concat(
"package attbad;\n",
"@test fn hidden() void = { assert(false); };\n"));
let tags: []str = ["root-conflict", "import-leaf", "root-missing",
"root-invalid"];
"root-invalid", "attest-noncanon"];
let targets: []str = [rootbad, strings.concat(importbad,
"/entry.ww"), missing, invalid];
"/entry.ww"), missing, invalid, attbad];
let needles: []str = ["conflicting package names",
"does not match import path",
"invalid or missing package clause",
"invalid or missing package clause"];
"invalid or missing package clause",
"@test declaration outside *_test.ww"];
let r: i32 = 0;
for (r < tags.len) {
rejectpair(tags[r], td, targets[r], needles[r]);