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.
15 lines
832 B
Rust
15 lines
832 B
Rust
// expect: run
|
|
// result: 42
|
|
// phase: 6
|
|
// spec: docs/spec/16-standard-library.md §2.19
|
|
module test.path
|
|
import std.path;
|
|
import std.bytes;
|
|
fn written(result: std.path.WriteResult) -> usize effects [] {
|
|
match result { std.path.WriteResult::ok(n) => { return n; }, std.path.WriteResult::invalid_input => { trap; }, std.path.WriteResult::size_overflow => { trap; }, std.path.WriteResult::short_output => { trap; } }
|
|
}
|
|
fn main() -> u64 effects [] {
|
|
var bytes: [u8;3] = [255u8;3]; let n = written(std.path.normalize(mut bytes[1usize..2usize],b"very-long-component/..")); assert(n == 1usize); assert(bytes[1] == 46u8); assert(bytes[0] == 255u8); assert(bytes[2] == 255u8);
|
|
let count = written(std.path.join(mut bytes[1usize..2usize],b"very-long-component",b"../x")); assert(count == 1usize); assert(bytes[1] == 120u8); return 42;
|
|
}
|