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,8 +1,6 @@
|
||||
// ostest — exercises lib/os surface that doesn't have a dedicated
|
||||
// test elsewhere. Covers [[os.getenv]] and a direct
|
||||
// [[os.alloc]] / [[os.free]] roundtrip. memio's tests indirectly
|
||||
// cover alloc/free; the direct row here pins the FFI shape under
|
||||
// lib/os itself so future bindings refactors can't quietly drift.
|
||||
// memio's tests indirectly cover alloc/free; the direct row here pins
|
||||
// the FFI shape under lib/os itself so future bindings refactors can't
|
||||
// quietly drift.
|
||||
//
|
||||
// getenv env contract (ww ships no setenv primitive, deliberately):
|
||||
//
|
||||
@@ -45,8 +43,6 @@ fn ostestwait(pid: i32, status: *i32) i32 = {
|
||||
return -1;
|
||||
};
|
||||
|
||||
// ---- getenv: set var → matching value -------------------------------
|
||||
|
||||
@test fn test_getenv_set() void = {
|
||||
let r = os.getenv("WW_TEST_GETENV");
|
||||
match (r) {
|
||||
@@ -57,11 +53,9 @@ fn ostestwait(pid: i32, status: *i32) i32 = {
|
||||
};
|
||||
};
|
||||
|
||||
// ---- getenv: empty value (set but zero-length) ----------------------
|
||||
//
|
||||
// POSIX permits an env var with an empty value (`name=` in environ).
|
||||
// getenv must return the empty str, NOT void — void is reserved for
|
||||
// "name not present at all". This row exercises the boundary.
|
||||
// "name not present at all".
|
||||
|
||||
@test fn test_getenv_empty() void = {
|
||||
let r = os.getenv("WW_TEST_EMPTY");
|
||||
@@ -73,8 +67,6 @@ fn ostestwait(pid: i32, status: *i32) i32 = {
|
||||
};
|
||||
};
|
||||
|
||||
// ---- getenv: unset var → void ---------------------------------------
|
||||
|
||||
@test fn test_getenv_unset() void = {
|
||||
let r = os.getenv("WW_TEST_NOT_SET");
|
||||
match (r) {
|
||||
@@ -83,8 +75,6 @@ fn ostestwait(pid: i32, status: *i32) i32 = {
|
||||
};
|
||||
};
|
||||
|
||||
// ---- getenv: prefix-collision guard ---------------------------------
|
||||
//
|
||||
// Probes that "WW_TEST_GETEN" (a prefix of WW_TEST_GETENV) doesn't
|
||||
// match. Without the explicit `entry[name.len] == '='` check in
|
||||
// getenv, a naive prefix matcher would return the value of any
|
||||
@@ -103,8 +93,6 @@ fn ostestwait(pid: i32, status: *i32) i32 = {
|
||||
};
|
||||
};
|
||||
|
||||
// ---- getenvs: direct non-vacuous coverage of the []str shape --------
|
||||
//
|
||||
// getenvs() is public API (task #28) and the single env walker getenv
|
||||
// routes through. getenv's cases exercise the walk transitively, but
|
||||
// none asserts the []str RETURN shape — its count or "NAME=VALUE" entry
|
||||
@@ -139,8 +127,6 @@ fn ostestwait(pid: i32, status: *i32) i32 = {
|
||||
};
|
||||
};
|
||||
|
||||
// ---- alloc/free: mmap-backed runtime allocator ----------------------
|
||||
//
|
||||
// Direct round-trip. Write-then-read-back proves the returned page is
|
||||
// dereferenceable. A miscompiled binding (wrong arg order, wrong ABI,
|
||||
// etc.) would either fault or return zero here.
|
||||
|
||||
Reference in New Issue
Block a user