From 7e951e504302dc2a7b0efa3e2ea0dcde5524ac60 Mon Sep 17 00:00:00 2001 From: hellerve Date: Thu, 29 Mar 2018 10:23:44 +0200 Subject: st/os: address @andrewrk concerns --- std/os/index.zig | 7 ++++--- std/os/test.zig | 6 ++++++ 2 files changed, 10 insertions(+), 3 deletions(-) (limited to 'std/os') diff --git a/std/os/index.zig b/std/os/index.zig index eb753db9b7..d8e2fd7009 100644 --- a/std/os/index.zig +++ b/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. diff --git a/std/os/test.zig b/std/os/test.zig index 2606dc1c58..20d439cc48 100644 --- a/std/os/test.zig +++ b/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); + } } -- cgit v1.2.3