ww: enforce internal package visibility

This commit is contained in:
2026-08-13 15:37:51 +09:00
parent af0f56dfe5
commit 9a5dbac84f
4 changed files with 378 additions and 25 deletions

View File

@@ -157,6 +157,25 @@ fn istype(m: os.mode, t: os.mode) bool = {
rmtree(&t);
};
@test fn test_readlink_verbatim() void = {
let t: tree;
mktree(&t);
let buf: [16]u8;
let i: i32 = 0;
for (i < 16) { buf[i] = 90u8; i += 1; }; // 'Z'
let n: i64 = os.readlink(t.symlink, &buf[0], 16u64);
assert(!(n != 9i64));
let want: str = "./regfile";
i = 0;
for (i < want.len) {
assert(!(buf[i] != want[i]));
i += 1;
};
let ni: i32 = n: i32;
assert(!(buf[ni] != 90u8));
rmtree(&t);
};
@test fn test_fstat_regfile() void = {
let t: tree;
mktree(&t);
@@ -196,7 +215,7 @@ fn istype(m: os.mode, t: os.mode) bool = {
};
// kpath copies into a single [PATH_MAX]u8 buffer and reserves one byte
// for the NUL terminator (`p.len + 1 >= PATH_MAX` → reject). The
// for the NUL terminator (`p.len + 1 > PATH_MAX` → reject). The
// rejection surfaces as `oserror = -36` (ENAMETOOLONG) on (... |
// oserror)-returning wrappers, and as `false` on [[os.exists]]
// (Hare's os::exists doc: "true if a node exists at the given path,