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.
18 lines
835 B
Rust
18 lines
835 B
Rust
// expect: run
|
|
// result: 42
|
|
// phase: 6
|
|
// spec: docs/spec/16-standard-library.md §2.19
|
|
// schedules: 12
|
|
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 worker(path: slice<u8>) -> usize effects [] { let result = std.path.basename(path); return result.end - result.start; }
|
|
fn main() -> u64 effects [task.spawn,task.wait] {
|
|
let path = b"/data/file.txt";
|
|
{ ref input = path; scope s { let a = task.spawn(s,worker,input); let b = task.spawn(s,worker,input); assert(task.join(move a) == 8usize); assert(task.join(move b) == 8usize); } }
|
|
return 42;
|
|
}
|