aboutsummaryrefslogtreecommitdiff
path: root/lib/std/testing.zig
diff options
context:
space:
mode:
authorJakub Konka <kubkon@jakubkonka.com>2020-06-23 21:54:36 +0200
committerJakub Konka <kubkon@jakubkonka.com>2020-06-23 21:54:36 +0200
commit66e5205047576768f075ec8f016f6fe21ce71bd0 (patch)
tree2456fd5d749907879298e1faea90b779d0c0b370 /lib/std/testing.zig
parent78c6d39cd49225bdfd2de4da7b1730ba26a41ba4 (diff)
downloadzig-66e5205047576768f075ec8f016f6fe21ce71bd0.tar.gz
zig-66e5205047576768f075ec8f016f6fe21ce71bd0.zip
Refactor PreopenList.find()
This commit generalizes `std.fs.wasi.PreopenList.find(...)` allowing search by `std.fs.wasi.PreopenType` union type rather than by dir name. In the future releases of WASI, it is expected to have more preopen types (or capabilities) than just directories. This commit aligns itself with that vision. This is a potentially breaking change. However, since `std.fs.wasi.PreopenList` wasn't made part of any Zig release yet, I think we should be OK to introduce those changes without pointing to any deprecations.
Diffstat (limited to 'lib/std/testing.zig')
-rw-r--r--lib/std/testing.zig2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/std/testing.zig b/lib/std/testing.zig
index 2d136d56c9..117a788e16 100644
--- a/lib/std/testing.zig
+++ b/lib/std/testing.zig
@@ -215,7 +215,7 @@ fn getCwdOrWasiPreopen() std.fs.Dir {
defer preopens.deinit();
preopens.populate() catch
@panic("unable to make tmp dir for testing: unable to populate preopens");
- const preopen = preopens.find(".") orelse
+ const preopen = preopens.find(std.fs.wasi.PreopenType{ .Dir = "." }) orelse
@panic("unable to make tmp dir for testing: didn't find '.' in the preopens");
return std.fs.Dir{ .fd = preopen.fd };