test: cover exact package tool invocation paths
This commit is contained in:
@@ -76,6 +76,17 @@ export fn writefile(path: str, content: str) void = {
|
||||
assert(os.close(fd) == 0);
|
||||
};
|
||||
|
||||
export fn writeexecutable(path: str, content: str) void = {
|
||||
let fd: i32 = os.open(path,
|
||||
os.flag.WRONLY | os.flag.CREATE | os.flag.EXCL, 448i32);
|
||||
assert(fd >= 0);
|
||||
match (os.writeall(fd, content.ptr, content.len: u64)) {
|
||||
case let n: i64 => assert(n == content.len: i64);
|
||||
case let e: os.oserror => abort("write failed");
|
||||
};
|
||||
assert(os.close(fd) == 0);
|
||||
};
|
||||
|
||||
export fn exists(path: str) bool = {
|
||||
return os.access(path, 0i32) == 0;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user