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:
@@ -1,6 +1,3 @@
|
||||
// fmttest — exercises lib/fmt's stream sinks (fprint / fprintln).
|
||||
// Run with `out/bin/ww run lib/fmt/fmttest.ww`.
|
||||
//
|
||||
// Each @test writes through a memio.stream and compares the resulting
|
||||
// bytes against an inline `want` literal. Bodies are short enough that
|
||||
// the parallel-array idiom used by memiotest doesn't apply — every row
|
||||
@@ -24,10 +21,6 @@ fn streq(a: str, b: str) bool = {
|
||||
return true;
|
||||
};
|
||||
|
||||
// ---- an error-returning stream for the io.error surfacing test --------
|
||||
//
|
||||
// Replaces the OLD io.closed source. errvt is module-static; its
|
||||
// reader/writer return a nomem-widened io.error.
|
||||
let errvt: io.vtable;
|
||||
|
||||
fn errread(s: io.stream, buf: []u8) (size | io.eof | io.error) = {
|
||||
@@ -42,8 +35,6 @@ fn errsource() io.stream = {
|
||||
return &errvt;
|
||||
};
|
||||
|
||||
// ---- fprint: bare str --------------------------------------------------
|
||||
|
||||
@test fn fprintbarestr() void = {
|
||||
let mem: memio.stream = memio.dynamic();
|
||||
let s: io.stream = &mem.vt;
|
||||
@@ -59,8 +50,6 @@ fn errsource() io.stream = {
|
||||
match (c) { case void => {}; case let eioe: io.error => abort(); };
|
||||
};
|
||||
|
||||
// ---- fprint: int + str mix, space-separated ----------------------------
|
||||
|
||||
@test fn fprintintstr() void = {
|
||||
let mem: memio.stream = memio.dynamic();
|
||||
let s: io.stream = &mem.vt;
|
||||
@@ -76,8 +65,7 @@ fn errsource() io.stream = {
|
||||
match (c) { case void => {}; case let eioe: io.error => abort(); };
|
||||
};
|
||||
|
||||
// ---- fprint: i64::MIN / int MIN whole-magnitude (#67) ------------------
|
||||
// i64dec used `n = -n` within i64, which wraps at i64::MIN (-MIN == MIN),
|
||||
// #67: i64dec used `n = -n` within i64, which wraps at i64::MIN (-MIN == MIN),
|
||||
// so the digit loop never ran and only the bare '-' was emitted. The fix
|
||||
// takes the magnitude through math.absi64 into u64. These rows pin the
|
||||
// boundary value plus a normal negative, zero, and int MIN.
|
||||
@@ -114,8 +102,6 @@ fn errsource() io.stream = {
|
||||
match (c) { case void => {}; case let eioe: io.error => abort(); };
|
||||
};
|
||||
|
||||
// ---- fprint: bool + rune renders as "true A" --------------------------
|
||||
|
||||
@test fn fprintboolrune() void = {
|
||||
let mem: memio.stream = memio.dynamic();
|
||||
let s: io.stream = &mem.vt;
|
||||
@@ -131,8 +117,6 @@ fn errsource() io.stream = {
|
||||
match (c) { case void => {}; case let eioe: io.error => abort(); };
|
||||
};
|
||||
|
||||
// ---- fprint: zero args returns 0, no bytes written --------------------
|
||||
|
||||
@test fn fprintempty() void = {
|
||||
let mem: memio.stream = memio.dynamic();
|
||||
let s: io.stream = &mem.vt;
|
||||
@@ -148,8 +132,6 @@ fn errsource() io.stream = {
|
||||
match (c) { case void => {}; case let eioe: io.error => abort(); };
|
||||
};
|
||||
|
||||
// ---- fprintln: multi-arg, trailing '\n' --------------------------------
|
||||
|
||||
@test fn fprintlnmulti() void = {
|
||||
let mem: memio.stream = memio.dynamic();
|
||||
let s: io.stream = &mem.vt;
|
||||
@@ -165,8 +147,6 @@ fn errsource() io.stream = {
|
||||
match (c) { case void => {}; case let eioe: io.error => abort(); };
|
||||
};
|
||||
|
||||
// ---- fprintln: zero args writes just the newline ----------------------
|
||||
|
||||
@test fn fprintlnempty() void = {
|
||||
let mem: memio.stream = memio.dynamic();
|
||||
let s: io.stream = &mem.vt;
|
||||
@@ -182,7 +162,6 @@ fn errsource() io.stream = {
|
||||
match (c) { case void => {}; case let eioe: io.error => abort(); };
|
||||
};
|
||||
|
||||
// ---- fprint over a fixed stream: short writes return partial count ----
|
||||
// memio.fixedwrite caps each call at the remaining buffer space and
|
||||
// never closes the stream, so fprint sees a short i32 result, not
|
||||
// io.error. Verifies the inner-loop arithmetic adds the actual byte
|
||||
@@ -204,7 +183,6 @@ fn errsource() io.stream = {
|
||||
match (c) { case void => {}; case let eioe: io.error => abort(); };
|
||||
};
|
||||
|
||||
// ---- fprint over a closed stream surfaces io.error -------------------
|
||||
// Exercises the early-return arm in fprint's inner match — distinct from
|
||||
// the short-write path above, which keeps returning i32 from a partial
|
||||
// accept. Single arm is enough: every formattable case routes errors
|
||||
@@ -220,10 +198,7 @@ fn errsource() io.stream = {
|
||||
};
|
||||
};
|
||||
|
||||
// ---- fprintf scenarios -------------------------------------------------
|
||||
// Each scenario writes through memio.dynamic and compares bytes against
|
||||
// an inline `want`. Variadic call-site shape forces one body per shape;
|
||||
// see the file header.
|
||||
// Variadic call-site shape forces one body per shape; see the file header.
|
||||
|
||||
@test fn fprintf_implicit() void = {
|
||||
let mem: memio.stream = memio.dynamic();
|
||||
@@ -303,8 +278,7 @@ fn errsource() io.stream = {
|
||||
match (c) { case void => {}; case let eioe: io.error => abort(); };
|
||||
};
|
||||
|
||||
// ---- fprint: rune args emit full UTF-8, not a truncated byte (#66) -----
|
||||
// writeone/formatraw's rune arm did `buf[0] = r: u8; putbytes(...,1)`,
|
||||
// #66: writeone/formatraw's rune arm did `buf[0] = r: u8; putbytes(...,1)`,
|
||||
// emitting only the low byte (invalid UTF-8 for r > 0x7F). The fix routes
|
||||
// through utf8.encoderune (ref/hare/fmt/print.ha:84). Edge runes: é (2B),
|
||||
// € (3B), 😀 (4B), A (1B).
|
||||
@@ -558,8 +532,6 @@ fn errsource() io.stream = {
|
||||
os.free(r.ptr: *void, r.len: u64);
|
||||
};
|
||||
|
||||
// ---- f64 dispatch arm -------------------------------------------------
|
||||
//
|
||||
// Pins the f64 formattable arm landed under task #17 (unblocked by #30
|
||||
// — the variant-widen-from-X0 fix). strconv.f64tos drives the render;
|
||||
// see lib/strconv/strconv.ww for the documented subset (fixed-point,
|
||||
|
||||
Reference in New Issue
Block a user