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 @@
|
||||
// getopttest — exercises lib/getopt. Run with
|
||||
// `out/bin/ww run lib/getopt/getopttest.ww`.
|
||||
//
|
||||
// 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
|
||||
@@ -36,8 +33,6 @@ fn streq(a: str, b: str) bool = {
|
||||
return true;
|
||||
};
|
||||
|
||||
// ---- flagcluster: -Fahs files.txt → 4 flags + 1 arg --------------------
|
||||
|
||||
@test fn flagcluster() void = {
|
||||
let helps: [5]getopt.help;
|
||||
getopt.cmdhelp(&helps[0], "list files");
|
||||
@@ -82,8 +77,6 @@ fn streq(a: str, b: str) bool = {
|
||||
getopt.finish(&cmd);
|
||||
};
|
||||
|
||||
// ---- paramflag: glued + separated arguments ----------------------------
|
||||
|
||||
@test fn paramflag() void = {
|
||||
let helps: [3]getopt.help;
|
||||
getopt.cmdhelp(&helps[0], "edit");
|
||||
@@ -125,8 +118,6 @@ fn streq(a: str, b: str) bool = {
|
||||
getopt.finish(&cmd);
|
||||
};
|
||||
|
||||
// ---- separator: -- ends option processing ------------------------------
|
||||
//
|
||||
// `--` in three positions: after a flag, immediately after argv[0],
|
||||
// and at the tail with nothing trailing. Flat-packed argv per
|
||||
// errortable's pattern; rows expect distinct (optslen, argslen,
|
||||
@@ -176,8 +167,6 @@ fn streq(a: str, b: str) bool = {
|
||||
};
|
||||
};
|
||||
|
||||
// ---- repeatedflag: -vvv → 3 v opts -------------------------------------
|
||||
|
||||
@test fn repeatedflag() void = {
|
||||
let helps: [2]getopt.help;
|
||||
getopt.cmdhelp(&helps[0], "verbose count");
|
||||
@@ -207,8 +196,6 @@ fn streq(a: str, b: str) bool = {
|
||||
getopt.finish(&cmd);
|
||||
};
|
||||
|
||||
// ---- baredash: "-" alone is a positional --------------------------------
|
||||
//
|
||||
// Bare `-` in three positions: trailing after a flag, leading (which
|
||||
// halts option scanning), and followed by what looks like a flag
|
||||
// (also halts — first non-flag wins).
|
||||
@@ -257,8 +244,6 @@ fn streq(a: str, b: str) bool = {
|
||||
};
|
||||
};
|
||||
|
||||
// ---- errortable: unknownopt + requiresarg variants ---------------------
|
||||
//
|
||||
// Parallel arrays per row: argv flat-packed into `srcs`, with `argo`
|
||||
// the offset and `argn` the count for each row.
|
||||
@test fn errortable() void = {
|
||||
@@ -306,8 +291,6 @@ fn streq(a: str, b: str) bool = {
|
||||
};
|
||||
};
|
||||
|
||||
// ---- strerrortext: render both error kinds -----------------------------
|
||||
//
|
||||
// Parallel rows over (kind, flag, name) → expected message. `kind`
|
||||
// rides as i32 because the errorkind enum doesn't yet index an
|
||||
// array element directly.
|
||||
@@ -332,8 +315,6 @@ fn streq(a: str, b: str) bool = {
|
||||
};
|
||||
};
|
||||
|
||||
// ---- nooptionsbare: argv with only program name + positionals ----------
|
||||
//
|
||||
// Positional-only argv at three lengths: two positionals, one
|
||||
// positional, and the program-name-only edge.
|
||||
@test fn nooptionsbare() void = {
|
||||
@@ -380,8 +361,6 @@ fn streq(a: str, b: str) bool = {
|
||||
};
|
||||
};
|
||||
|
||||
// ---- printusage_cases: table of width-measure paths --------------------
|
||||
//
|
||||
// ref/hare/getopt/getopts.ha:202-265.
|
||||
// Row 0: short line (≤72) — auto-[-h] + FLAG cluster, no wrap.
|
||||
// Row 1: long line (>72) — PARAM slots each prefixed with \n\t.
|
||||
@@ -434,8 +413,6 @@ fn streq(a: str, b: str) bool = {
|
||||
};
|
||||
};
|
||||
|
||||
// ---- optionsizepin: option is 32B, not 24B -----------------------------
|
||||
//
|
||||
// tryparse/finish free the parsed-option array at `cap * size(option)`.
|
||||
// option = rune (4) + pad (4) + str (24, #1/Phase 3) = 32B. A hardcoded
|
||||
// `24u64` here was an 8-byte-per-element under-free; pinning the size
|
||||
@@ -445,8 +422,6 @@ fn streq(a: str, b: str) bool = {
|
||||
assert(!(size(getopt.option) != 32));
|
||||
};
|
||||
|
||||
// ---- freeroundtrip: parse → finish over {0, 1, several} options --------
|
||||
//
|
||||
// Exercises the free path at three distinct cap values so the
|
||||
// `cap * size(option)` free in [[finish]] runs for an empty, single,
|
||||
// and multi-element option array. The under-free is not directly
|
||||
@@ -493,8 +468,6 @@ fn streq(a: str, b: str) bool = {
|
||||
};
|
||||
};
|
||||
|
||||
// ---- printhelp_cases: table of help-output paths ----------------------
|
||||
//
|
||||
// ref/hare/getopt/getopts.ha:281-314.
|
||||
// Row 0: empty help slice → early return, no output.
|
||||
// Row 1: full help (CMD+FLAG+PARAM+CMD) → summary + usage + option list.
|
||||
|
||||
Reference in New Issue
Block a user