lib: banner purge + WHY-only comment sweep (rule 8)

Every // ---- section banner dies (132 -> 0): names carry the WHAT.
Narration deleted (filename restatements, run-with lines, what-the-
next-line-does); every ref/hare cite, task cite, divergence, ABI/
layout contract, and ownership qualifier kept (borrowed-view lines
restored where the sweep over-cut). Comment-only proven: all 442
walk-workdir .s and 32 import-probe .s byte-identical before/after;
libbyteid 56-roster all-ID.
This commit is contained in:
2026-08-08 21:10:18 +09:00
parent 659e859f34
commit aadc6618f0
90 changed files with 259 additions and 919 deletions

View File

@@ -113,9 +113,8 @@ fn nextrand() u64 = {
// exposes getenv; documented in the file header.
fn gettmpdir() str = { return "/tmp"; };
// puts — copy `s` into pathbuf starting at `off`. Caps writes
// against pathbuf's capacity so a long caller-supplied dir can't
// run off the end. Returns the new offset.
// Caps writes against pathbuf's capacity so a long caller-supplied
// dir can't run off the end.
fn puts(off: i32, s: str) i32 = {
let i: i32 = 0;
for (i < s.len) {
@@ -126,7 +125,6 @@ fn puts(off: i32, s: str) i32 = {
return off + i;
};
// puthex — 16 lowercase hex digits of `v` into pathbuf[off..off+16].
fn puthex(off: i32, v: u64) i32 = {
let hex: str = "0123456789abcdef";
let i: i32 = 0;

View File

@@ -1,6 +1,3 @@
// temptest — exercises lib/temp. Run with
// `out/bin/ww build lib/temp/temptest.ww && ./temptest`.
//
// Every @test enumerates parallel `[N]T` arrays of inputs and
// expectations, then iterates one body across them. Parallel arrays
// (rather than `[N]struct{...}`) sidestep the cstage cgen's chained
@@ -28,8 +25,6 @@ fn streq(a: str, b: str) bool = {
return true;
};
// ---- namedroundtrip: write + read-back across payload sizes ------------
@test fn namedroundtrip() void = {
// (payload size, fill byte). Row 0 covers the zero-byte edge.
let sz: [4]i32;
@@ -56,7 +51,6 @@ fn streq(a: str, b: str) bool = {
assert(!(!streq(strslice(p, 0, 10), "/tmp/temp.")));
assert(!(p.ptr[p.len] != 0u8));
// Build fill payload, write it, lseek to 0, read it back.
let wbuf: [64]u8;
let k: i32 = 0;
for (k < sz[i]) { wbuf[k] = fill[i]; k += 1; };
@@ -82,13 +76,11 @@ fn streq(a: str, b: str) bool = {
k2 += 1;
};
// File exists pre-cleanup.
assert(!(os.access(p, 0i32) != 0));
assert(!(os.close(fd) != 0));
assert(!(os.remove(p) != 0));
// Cleanup landed.
assert(!(os.access(p, 0i32) == 0));
i += 1;
@@ -104,8 +96,6 @@ fn strslice(p: str, lo: i32, hi: i32) str = {
return r;
};
// ---- namedoverwrite: static buffer is reused across calls --------------
//
// Hare docs: "The name is statically allocated, and will be
// overwritten on subsequent calls." Match that contract — the second
// named() call lands in the same buffer, so p1.ptr == p2.ptr.
@@ -141,7 +131,6 @@ fn strslice(p: str, lo: i32, hi: i32) str = {
assert(!(p1.ptr != p2.ptr));
assert(!(streq(strslice(p2, 0, p2.len), psnap)));
// Both fds are distinct.
assert(!(fd1 == fd2));
assert(!(os.close(fd2) != 0));
@@ -160,8 +149,6 @@ fn strslice(p: str, lo: i32, hi: i32) str = {
// Coverage for the underlying open+create+EXCL path lives in
// [[namedroundtrip]] / [[namedoverwrite]].
// ---- dirlifecycle: empty dir, then dir + one child file ----------------
@test fn dirlifecycle() void = {
// (child count). Row 0: empty dir. Row 1: dir + one file.
let childn: [2]i32;
@@ -175,7 +162,6 @@ fn strslice(p: str, lo: i32, hi: i32) str = {
assert(!(!streq(strslice(d, 0, 5), "/tmp/")));
assert(!(d.ptr[d.len] != 0u8));
// Dir exists.
assert(!(os.access(d, 0i32) != 0));
// Snapshot the dir path into a local NUL-terminated buffer:
@@ -192,7 +178,6 @@ fn strslice(p: str, lo: i32, hi: i32) str = {
dview.ptr = &dsnap[0]; dview.len = dlen;
if (childn[i] > 0) {
// Build "<d>/x\0" in a local buffer.
let cbuf: [144]u8;
let off: i32 = 0;
let j: i32 = 0;
@@ -217,15 +202,12 @@ fn strslice(p: str, lo: i32, hi: i32) str = {
// touched between dir() and here).
assert(!(os.rmdir(dview) != 0));
// Cleanup landed.
assert(!(os.access(dview, 0i32) == 0));
i += 1;
};
};
// ---- diruniqueness: two dir() calls produce different paths ------------
@test fn diruniqueness() void = {
let d1: str = temp.dir();
let snap: [128]u8;