lib: split strings tests per ref/hare/strings families + helpers file
Unblocked by the package-mode ruling: same-package test files now
compose everywhere (coordinator dir-mode owns test-library and the
libbyteid dir entry owns byte identity), so the per-file standalone
constraint is gone and Go's stdlib layout applies directly. The
15-banner strings_test.ww monolith dissolves into per-ref-file
family files — dup, concat, trim, sub, utf8, iter, tokenize
(tokenize+splitn+cut, all of ref tokenize.ha), pad, replace — plus
helpers_test.ww holding exactly the one cross-family helper (streq),
Go's shared test-helper idiom. Pure moves; family-local helpers
(expect_str_token et al.) stay in their family file. Leading banners
that merely restated the filename dropped; 6 interior sub-family
boundaries remain. lib/ census 141 -> 132.
libbyteid gains the dx() dir-mode entry form decided in B2: compose
every *_test.ww under moddir exactly as pkgcombined does
(module-reset separators, byte-lex order) and byte-id the composed
root through both driver stages. The five per-file strings fx
entries retire into one dx("lib/strings") — every source line they
covered is inside the composed unit, and the completeness scan still
keys the module. NENTEXPECT 60 -> 56.
Recorded, not split: fmt_test's 13 banners are scenario groups over
the one fprint surface and ref/hare/fmt itself keeps a single
+test.ha — a print/wrappers split would fight the ref; memio stays
per the standing ruling (everything ww ports lives in ref
stream.ha).
This commit is contained in:
23
lib/strings/utf8_test.ww
Normal file
23
lib/strings/utf8_test.ww
Normal file
@@ -0,0 +1,23 @@
|
||||
// Vectors mirror ref/hare/strings/utf8.ha where ww can express them.
|
||||
// External strings_test package per the Go foo_test idiom (rule-5/9
|
||||
// carve-out, task #16); the shared streq helper lives in
|
||||
// helpers_test.ww — same-package test files compose in dir-mode
|
||||
// (the package, not the file, is the unit of testing).
|
||||
package strings_test;
|
||||
|
||||
import strings;
|
||||
import encoding.utf8;
|
||||
|
||||
// ref/hare/strings/utf8.ha:31. Validation-half coverage lives in
|
||||
// lib/encoding/utf8 (utf8test) per CLAUDE.md rule 9 carve-out.
|
||||
|
||||
@test fn utf8_roundtrip_cases() void = {
|
||||
let s: str = "hello";
|
||||
let b: []u8 = strings.toutf8(s);
|
||||
assert(!(b.len != 5));
|
||||
assert(!(b[0] != 104u8)); // 'h'
|
||||
let r: str = strings.frombytes(b);
|
||||
assert(!(!streq(r, "hello")));
|
||||
assert(!(r.ptr != s.ptr)); // borrowed, not copied
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user