Commit 7e951e5043

hellerve <veit@veitheller.de>
2018-03-29 10:23:44
st/os: address @andrewrk concerns
1 parent f5b43ad
Changed files (2)
std/os/index.zig
@@ -1134,7 +1134,7 @@ pub const Dir = struct {
             SymLink,
             File,
             UnixDomainSocket,
-            Wht, // TODO wtf is this
+            Whiteout,
             Unknown,
         };
     };
@@ -1223,7 +1223,7 @@ pub const Dir = struct {
                 posix.DT_LNK => Entry.Kind.SymLink,
                 posix.DT_REG => Entry.Kind.File,
                 posix.DT_SOCK => Entry.Kind.UnixDomainSocket,
-                posix.DT_WHT => Entry.Kind.Wht,
+                posix.DT_WHT => Entry.Kind.Whiteout,
                 else => Entry.Kind.Unknown,
             };
             return Entry {
@@ -1759,11 +1759,12 @@ test "std.os" {
     _ = @import("linux/index.zig");
     _ = @import("path.zig");
     _ = @import("windows/index.zig");
+    _ = @import("test.zig");
 }
 
 
 // TODO make this a build variable that you can set
-const unexpected_error_tracing = true;
+const unexpected_error_tracing = false;
 
 /// Call this when you made a syscall or something that sets errno
 /// and you get an unexpected error.
std/os/test.zig
@@ -1,5 +1,6 @@
 const std = @import("../index.zig");
 const os = std.os;
+const debug = std.debug;
 const io = std.io;
 
 const a = std.debug.global_allocator;
@@ -9,4 +10,9 @@ test "makePath, put some files in it, deleteTree" {
     try io.writeFile(a, "os_test_tmp/b/c/file.txt", "nonsense");
     try io.writeFile(a, "os_test_tmp/b/file2.txt", "blah");
     try os.deleteTree(a, "os_test_tmp");
+    if (os.Dir.open(a, "os_test_tmp")) |dir| {
+        debug.assert(false); // this should not happen!
+    } else |err| {
+        debug.assert(err == error.PathNotFound);
+    }
 }