@@ -277,12 +277,15 @@ test "directory operations on files" {
277
277
try testing .expectError (error .NotDir , tmp_dir .dir .openDir (test_file_name , .{}));
278
278
try testing .expectError (error .NotDir , tmp_dir .dir .deleteDir (test_file_name ));
279
279
280
- if (builtin .os .tag != .wasi and builtin .os .tag != .freebsd and builtin .os .tag != .openbsd ) {
281
- const absolute_path = try tmp_dir .dir .realpathAlloc (testing .allocator , test_file_name );
282
- defer testing .allocator .free (absolute_path );
280
+ switch (builtin .os .tag ) {
281
+ .wasi , .freebsd , .openbsd , .dragonfly = > {},
282
+ else = > {
283
+ const absolute_path = try tmp_dir .dir .realpathAlloc (testing .allocator , test_file_name );
284
+ defer testing .allocator .free (absolute_path );
283
285
284
- try testing .expectError (error .PathAlreadyExists , fs .makeDirAbsolute (absolute_path ));
285
- try testing .expectError (error .NotDir , fs .deleteDirAbsolute (absolute_path ));
286
+ try testing .expectError (error .PathAlreadyExists , fs .makeDirAbsolute (absolute_path ));
287
+ try testing .expectError (error .NotDir , fs .deleteDirAbsolute (absolute_path ));
288
+ },
286
289
}
287
290
288
291
// ensure the file still exists and is a file as a sanity check
@@ -314,12 +317,15 @@ test "file operations on directories" {
314
317
// TODO: Add a read-only test as well, see https://github.com/ziglang/zig/issues/5732
315
318
try testing .expectError (error .IsDir , tmp_dir .dir .openFile (test_dir_name , .{ .write = true }));
316
319
317
- if (builtin .os .tag != .wasi and builtin .os .tag != .freebsd and builtin .os .tag != .openbsd ) {
318
- const absolute_path = try tmp_dir .dir .realpathAlloc (testing .allocator , test_dir_name );
319
- defer testing .allocator .free (absolute_path );
320
+ switch (builtin .os .tag ) {
321
+ .wasi , .freebsd , .openbsd , .dragonfly = > {},
322
+ else = > {
323
+ const absolute_path = try tmp_dir .dir .realpathAlloc (testing .allocator , test_dir_name );
324
+ defer testing .allocator .free (absolute_path );
320
325
321
- try testing .expectError (error .IsDir , fs .createFileAbsolute (absolute_path , .{}));
322
- try testing .expectError (error .IsDir , fs .deleteFileAbsolute (absolute_path ));
326
+ try testing .expectError (error .IsDir , fs .createFileAbsolute (absolute_path , .{}));
327
+ try testing .expectError (error .IsDir , fs .deleteFileAbsolute (absolute_path ));
328
+ },
323
329
}
324
330
325
331
// ensure the directory still exists as a sanity check
0 commit comments