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:
@@ -2,14 +2,6 @@
|
||||
// (ref/hare/shlex/{split.ha,escape.ha}) using ww byte-indexed cursors
|
||||
// in place of Hare's strings::iterator.
|
||||
//
|
||||
// Surface today:
|
||||
//
|
||||
// shlex.syntaxerr — !void; bad shell syntax
|
||||
// shlex.strerror(syntaxerr) — "Invalid shell syntax"
|
||||
// shlex.split(in: str) — tokenize; returns ([]str | syntaxerr)
|
||||
// shlex.quote(io.stream, s) — write `s` shell-quoted to a sink
|
||||
// shlex.quotestr(s: str) str — quote into a fresh str
|
||||
//
|
||||
// Owning model: split() returns a fresh `[]str` of strings.dup'd
|
||||
// elements; release with [[strings.freeall]] (Hare's natural disposer
|
||||
// shape). quotestr() returns an os.alloc'd str; release via
|
||||
@@ -227,7 +219,6 @@ export fn split(in: str) ([]str | syntaxerr) = {
|
||||
dirty = true;
|
||||
|
||||
if (r == ' ' || r == '\t' || r == '\n') {
|
||||
// Collapse a run of whitespace.
|
||||
let inner: bool = true;
|
||||
for (inner) {
|
||||
if (pos >= in.len) { inner = false; }
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
// shlextest — exercises lib/shlex. Run with
|
||||
// `out/bin/ww run lib/shlex/shlextest.ww`.
|
||||
//
|
||||
// Two cohorts, grouped Hare-style — one @test fn per cohort, table-
|
||||
// driven inside via per-arity helpers:
|
||||
//
|
||||
@@ -110,8 +107,6 @@ fn checkquote(in: str, expected: str) void = {
|
||||
let _c: (void | io.error) = io.close(snk);
|
||||
};
|
||||
|
||||
// ---- split: Hare's @test fn split() table --------------------------
|
||||
//
|
||||
// 9 success rows + 3 syntaxerr rows ported VERBATIM from
|
||||
// ref/hare/shlex/+test.ha; plus one ww-specific edge (empty input →
|
||||
// empty []str) confirmed by drew.
|
||||
@@ -146,8 +141,6 @@ fn checkquote(in: str, expected: str) void = {
|
||||
checkempty("");
|
||||
};
|
||||
|
||||
// ---- quote: Hare's testquote rows + the empty-input edge ----------
|
||||
//
|
||||
// 4 rows from ref/hare/shlex/+test.ha @test fn quote(). The empty-
|
||||
// input row (→ `''`) is implementation-specific (Hare's testquote
|
||||
// doesn't cover it) but is documented behaviour per shlex.ww's
|
||||
@@ -163,16 +156,12 @@ fn checkquote(in: str, expected: str) void = {
|
||||
checkquote("@%+=:,./-", "@%+=:,./-");
|
||||
};
|
||||
|
||||
// ---- quotestr ------------------------------------------------------
|
||||
|
||||
@test fn test_quotestr() void = {
|
||||
let r: str = shlex.quotestr("hello world");
|
||||
assert(!(!streq(r, "'hello world'")));
|
||||
// leak r — short-lived test process, same precedent as fnmatchtest.
|
||||
};
|
||||
|
||||
// ---- strerror ------------------------------------------------------
|
||||
|
||||
@test fn test_strerror() void = {
|
||||
let e: shlex.syntaxerr;
|
||||
let s: str = shlex.strerror(e);
|
||||
|
||||
Reference in New Issue
Block a user