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.
40 lines
1.1 KiB
Plaintext
40 lines
1.1 KiB
Plaintext
package log_test;
|
|
|
|
import log;
|
|
import memio;
|
|
|
|
// The silent logger's callback discards args without touching fmt or
|
|
// any sink. Verified indirectly: we wire a memio.stream and never
|
|
// pass it to log.silent — but the @test fn calling log.new first
|
|
// triggers [[log.ensureinit]] so log.silent is non-nil here. Then
|
|
// lprintln(silent, ...) must not crash and the memio sink must stay
|
|
// empty (silent has no path to it anyway).
|
|
@test fn silentwritesnothing() void = {
|
|
let buf: [16]u8;
|
|
let mem = memio.fixed(buf[0:16]);
|
|
let s = &mem.vt;
|
|
|
|
let sl = log.new(s); // triggers log.ensureinit; populates log.silent
|
|
|
|
assert(!(log.silent == nil));
|
|
|
|
log.lprintln(log.silent, "ignored", 1i64, true);
|
|
|
|
assert(!(mem.pos != 0));
|
|
};
|
|
|
|
// Same pattern as [[silentwritesnothing]] for the bare-args path.
|
|
@test fn silentignoresprintfln() void = {
|
|
let buf: [16]u8;
|
|
let mem = memio.fixed(buf[0:16]);
|
|
let s = &mem.vt;
|
|
|
|
let sl = log.new(s); // triggers log.ensureinit; populates log.silent
|
|
|
|
assert(!(log.silent == nil));
|
|
|
|
log.lprintfln(log.silent, "ignored={}", 1i64);
|
|
|
|
assert(!(mem.pos != 0));
|
|
};
|