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.
22 lines
910 B
Rust
22 lines
910 B
Rust
module demo.path
|
|
import std.path;
|
|
import std.bytes;
|
|
|
|
fn main() -> u64 effects [] {
|
|
var bytes: [u8;32] = [255u8;32];
|
|
let count = match std.path.join(mut bytes,b"/data/sub",b"../file.tar") {
|
|
std.path.WriteResult::ok(count) => { count },
|
|
std.path.WriteResult::invalid_input => { return 0; },
|
|
std.path.WriteResult::size_overflow => { return 0; },
|
|
std.path.WriteResult::short_output => { return 0; }
|
|
};
|
|
{ ref path = bytes[0usize..count];
|
|
assert(std.bytes.equal(path,b"/data/file.tar"));
|
|
let base = std.path.basename(path); let parent = std.path.parent(path); let extension = std.path.extension(path);
|
|
assert(std.bytes.equal(ref path[base.start..base.end],b"file.tar"));
|
|
assert(std.bytes.equal(ref path[parent.start..parent.end],b"/data"));
|
|
assert(std.bytes.equal(ref path[extension.start..extension.end],b"tar"));
|
|
}
|
|
return 42;
|
|
}
|