lib: split path_test into buffer/stack/posix tests per ref/hare/path
Mirror ref/hare/path's impl layout in the test siblings: abs/isroot/string/local rows -> buffer_test.ww (ref/hare/path/ buffer.ha:28-77); push/parent/pop-split rows -> stack_test.ww (ref/hare/path/stack.ha:9-180); dirname/basename rows -> posix_test.ww (ref/hare/path/posix.ha:17-71). Pure move: every @test block is byte-identical; only the section banner lines are deleted (file names now carry them) and each section's ref-cite WHY comment rides with its @test. The suite header's Hare-vector/parallel-array WHY paragraphs ride with stack_test.ww (push is their subject); the stale `ww run lib/path/path_test.ww` sentence is dropped, not relocated. Consumers: Makefile LIBRARY_TESTS entry replaced in place. The byteid roster is untouched: lib/path is enrolled there as an import-probe, not a fixture.
This commit is contained in:
36
lib/path/posix_test.ww
Normal file
36
lib/path/posix_test.ww
Normal file
@@ -0,0 +1,36 @@
|
||||
package path_test;
|
||||
|
||||
import path;
|
||||
|
||||
|
||||
// ref/hare/path/posix.ha:51-71. Hare seeds each row through _local/local()
|
||||
// for cross-platform SEP; on ww (Linux, SEP='/') that is identity, so the
|
||||
// raw str literals stand in directly (local/_local defer to c3). POSIX
|
||||
// dirname/basename do NOT normalize the input (posix.ha:14-15,35), so no
|
||||
// seeding is needed. Parallel `[N]str` rows (cgen chained-field gap, as
|
||||
// above). Rows whose expected is a borrowed VIEW (not a "."/"/" literal)
|
||||
// compare a computed str to a literal — cstage-correct; wwstage mis-
|
||||
// compares via #146 (str== over a frombytes result), and this @test is
|
||||
// cstage-gated, so those rows are #146-deferred on wwstage only.
|
||||
|
||||
@test fn dirname_basename_cases() void = {
|
||||
let inputs: [10]str;
|
||||
let wantdir: [10]str;
|
||||
let wantbase: [10]str;
|
||||
inputs[0]="usr"; wantdir[0]="."; wantbase[0]="usr";
|
||||
inputs[1]="usr/"; wantdir[1]="."; wantbase[1]="usr";
|
||||
inputs[2]=""; wantdir[2]="."; wantbase[2]=".";
|
||||
inputs[3]="/"; wantdir[3]="/"; wantbase[3]="/";
|
||||
inputs[4]="//"; wantdir[4]="/"; wantbase[4]="/"; // impl-defined
|
||||
inputs[5]="///"; wantdir[5]="/"; wantbase[5]="/";
|
||||
inputs[6]="/usr/"; wantdir[6]="/"; wantbase[6]="usr";
|
||||
inputs[7]="/usr/lib"; wantdir[7]="/usr"; wantbase[7]="lib";
|
||||
inputs[8]="//usr//lib//"; wantdir[8]="//usr"; wantbase[8]="lib";
|
||||
inputs[9]="/home//dwc//test"; wantdir[9]="/home//dwc"; wantbase[9]="test";
|
||||
let i: i32 = 0;
|
||||
for (i < 10) {
|
||||
assert(!(dirname(inputs[i]) != wantdir[i]));
|
||||
assert(!(basename(inputs[i]) != wantbase[i]));
|
||||
i += 1;
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user