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 {...@@ -1134,7 +1134,7 @@ pub const Dir = struct {
1134 SymLink,1134 SymLink,
1135 File,1135 File,
1136 UnixDomainSocket,1136 UnixDomainSocket,
1137 Wht, // TODO wtf is this1137 Whiteout,
1138 Unknown,1138 Unknown,
1139 };1139 };
1140 };1140 };
...@@ -1223,7 +1223,7 @@ pub const Dir = struct {...@@ -1223,7 +1223,7 @@ pub const Dir = struct {
1223 posix.DT_LNK => Entry.Kind.SymLink,1223 posix.DT_LNK => Entry.Kind.SymLink,
1224 posix.DT_REG => Entry.Kind.File,1224 posix.DT_REG => Entry.Kind.File,
1225 posix.DT_SOCK => Entry.Kind.UnixDomainSocket,1225 posix.DT_SOCK => Entry.Kind.UnixDomainSocket,
1226 posix.DT_WHT => Entry.Kind.Wht,1226 posix.DT_WHT => Entry.Kind.Whiteout,
1227 else => Entry.Kind.Unknown,1227 else => Entry.Kind.Unknown,
1228 };1228 };
1229 return Entry {1229 return Entry {
...@@ -1759,11 +1759,12 @@ test "std.os" {...@@ -1759,11 +1759,12 @@ test "std.os" {
1759 _ = @import("linux/index.zig");1759 _ = @import("linux/index.zig");
1760 _ = @import("path.zig");1760 _ = @import("path.zig");
1761 _ = @import("windows/index.zig");1761 _ = @import("windows/index.zig");
1762 _ = @import("test.zig");
1762}1763}
17631764
17641765
1765// TODO make this a build variable that you can set1766// TODO make this a build variable that you can set
1766const unexpected_error_tracing = true;1767const unexpected_error_tracing = false;
17671768
1768/// Call this when you made a syscall or something that sets errno1769/// Call this when you made a syscall or something that sets errno
1769/// and you get an unexpected error.1770/// and you get an unexpected error.
std/os/test.zig+6
...@@ -1,5 +1,6 @@...@@ -1,5 +1,6 @@
1const std = @import("../index.zig");1const std = @import("../index.zig");
2const os = std.os;2const os = std.os;
3const debug = std.debug;
3const io = std.io;4const io = std.io;
45
5const a = std.debug.global_allocator;6const a = std.debug.global_allocator;
...@@ -9,4 +10,9 @@ test "makePath, put some files in it, deleteTree" {...@@ -9,4 +10,9 @@ test "makePath, put some files in it, deleteTree" {
9 try io.writeFile(a, "os_test_tmp/b/c/file.txt", "nonsense");10 try io.writeFile(a, "os_test_tmp/b/c/file.txt", "nonsense");
10 try io.writeFile(a, "os_test_tmp/b/file2.txt", "blah");11 try io.writeFile(a, "os_test_tmp/b/file2.txt", "blah");
11 try os.deleteTree(a, "os_test_tmp");12 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 }
12}18}