cli: add caller-buffer lexical path APIs
Add pure std.path queries and failure-preserving normalization/join using safe reverse measurement/emission and caller-provided output storage. Component queries return explicit Copy ranges; filesystem authority is checked independently. Complete the STD-7 implementation gate. Validation: 1079 conformance cases, 18 path cases with per-step collection and 12-seed schedule stress, independent 132-path/49-join capacity oracle, 68 CLI checks, fourteen previous source/std CLI suites, unit/Quick Reference, formatting, hosted smoke, 117/117 source coverage and reference budgets.
This commit is contained in:
1 parent
8d8bef8f3e
commit
8edec5b831
35 files changed
+1189
-8
No files matched your search
@@ -0,0 +1,21 @@
|
||||
// expect: run
|
||||
// result: 42
|
||||
// phase: 6
|
||||
// spec: docs/spec/16-standard-library.md §2.19
|
||||
module test.path_bytes
|
||||
import std.path;
|
||||
fn main() -> u64 effects [] {
|
||||
for value in 1u16..256u16 {
|
||||
var path: [u8;1] = [0u8;1]; path[0] = value as! u8; var output: [u8;3] = [255u8;3];
|
||||
match std.path.normalize(mut output[1usize..2usize],ref path) {
|
||||
std.path.WriteResult::ok(n) => { assert(n == 1usize); assert(output[1] == path[0]); },
|
||||
std.path.WriteResult::invalid_input => { trap; }, std.path.WriteResult::size_overflow => { trap; }, std.path.WriteResult::short_output => { trap; }
|
||||
}
|
||||
assert(output[0] == 255u8); assert(output[2] == 255u8);
|
||||
let base = std.path.basename(ref path); assert(base.start == 0usize);
|
||||
if path[0] == 47u8 { assert(base.end == 0usize); } else { assert(base.end == 1usize); }
|
||||
assert(std.path.is_absolute(ref path) == (path[0] == 47u8));
|
||||
let ext = std.path.extension(ref path); assert(ext.start == base.end); assert(ext.end == base.end);
|
||||
}
|
||||
return 42;
|
||||
}
|
||||
Reference in new issue
Block a user