authorgravatar for veit@veitheller.dehellerve <veit@veitheller.de> 2018-03-29 10:23:44+02:00
committergravatar for veit@veitheller.dehellerve <veit@veitheller.de> 2018-03-29 10:23:44+02:00
log7e951e504302dc2a7b0efa3e2ea0dcde5524ac60
tree0b825544563b4b1aa36210f16b214bb1a3a3d134
parentf5b43ada469c94ba4968898a7102d27f5c8188f2

st/os: address @andrewrk concerns


2 files changed, 10 insertions(+), 3 deletions(-)

std/os/index.zig+4-3
......@@ -1134,7 +1134,7 @@ pub const Dir = struct {
11341134 SymLink,
11351135 File,
11361136 UnixDomainSocket,
1137 Wht, // TODO wtf is this
1137 Whiteout,
11381138 Unknown,
11391139 };
11401140 };
......@@ -1223,7 +1223,7 @@ pub const Dir = struct {
12231223 posix.DT_LNK => Entry.Kind.SymLink,
12241224 posix.DT_REG => Entry.Kind.File,
12251225 posix.DT_SOCK => Entry.Kind.UnixDomainSocket,
1226 posix.DT_WHT => Entry.Kind.Wht,
1226 posix.DT_WHT => Entry.Kind.Whiteout,
12271227 else => Entry.Kind.Unknown,
12281228 };
12291229 return Entry {
......@@ -1759,11 +1759,12 @@ test "std.os" {
17591759 _ = @import("linux/index.zig");
17601760 _ = @import("path.zig");
17611761 _ = @import("windows/index.zig");
1762 _ = @import("test.zig");
17621763}
17631764
17641765
17651766// TODO make this a build variable that you can set
1766const unexpected_error_tracing = true;
1767const unexpected_error_tracing = false;
17671768
17681769/// Call this when you made a syscall or something that sets errno
17691770/// and you get an unexpected error.
std/os/test.zig+6
......@@ -1,5 +1,6 @@
11const std = @import("../index.zig");
22const os = std.os;
3const debug = std.debug;
34const io = std.io;
45
56const a = std.debug.global_allocator;
......@@ -9,4 +10,9 @@ test "makePath, put some files in it, deleteTree" {
910 try io.writeFile(a, "os_test_tmp/b/c/file.txt", "nonsense");
1011 try io.writeFile(a, "os_test_tmp/b/file2.txt", "blah");
1112 try os.deleteTree(a, "os_test_tmp");
13 if (os.Dir.open(a, "os_test_tmp")) |dir| {
14 debug.assert(false); // this should not happen!
15 } else |err| {
16 debug.assert(err == error.PathNotFound);
17 }
1218}