| ... | @@ -83,8 +83,13 @@ test "file operations on directories" { | ... | @@ -83,8 +83,13 @@ test "file operations on directories" { |
| 83 | | 83 | |
| 84 | testing.expectError(error.IsDir, tmp_dir.dir.createFile(test_dir_name, .{})); | 84 | testing.expectError(error.IsDir, tmp_dir.dir.createFile(test_dir_name, .{})); |
| 85 | testing.expectError(error.IsDir, tmp_dir.dir.deleteFile(test_dir_name)); | 85 | testing.expectError(error.IsDir, tmp_dir.dir.deleteFile(test_dir_name)); |
| 86 | testing.expectError(error.IsDir, tmp_dir.dir.readFileAlloc(testing.allocator, test_dir_name, std.math.maxInt(usize))); | 86 | // Currently, WASI will return error.Unexpected (via ENOTCAPABLE) when attempting fd_read on a directory handle. |
| 87 | // note: the `.write = true` is necessary to ensure the error occurs on all platforms | 87 | // TODO: Re-enable on WASI once https://github.com/bytecodealliance/wasmtime/issues/1935 is resolved. |
| | 88 | if (builtin.os.tag != .wasi) { |
| | 89 | testing.expectError(error.IsDir, tmp_dir.dir.readFileAlloc(testing.allocator, test_dir_name, std.math.maxInt(usize))); |
| | 90 | } |
| | 91 | // Note: The `.write = true` is necessary to ensure the error occurs on all platforms. |
| | 92 | // TODO: Add a read-only test as well, see https://github.com/ziglang/zig/issues/5732 |
| 88 | testing.expectError(error.IsDir, tmp_dir.dir.openFile(test_dir_name, .{ .write = true })); | 93 | testing.expectError(error.IsDir, tmp_dir.dir.openFile(test_dir_name, .{ .write = true })); |
| 89 | | 94 | |
| 90 | if (builtin.os.tag != .wasi) { | 95 | if (builtin.os.tag != .wasi) { |