Skip to content

Commit

Permalink
os2: skip dir test when unsupported
Browse files Browse the repository at this point in the history
  • Loading branch information
laytan committed Nov 15, 2024
1 parent ce74325 commit 282d956
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion core/os/os2/dir_linux.odin
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ _read_directory_iterator :: proc(it: ^Read_Directory_Iterator) -> (fi: File_Info

@(require_results)
_read_directory_iterator_create :: proc(f: ^File) -> (Read_Directory_Iterator, Error) {
return {}, nil
return {}, .Unsupported
}

_read_directory_iterator_destroy :: proc(it: ^Read_Directory_Iterator) {
Expand Down
6 changes: 6 additions & 0 deletions tests/core/os/os2/dir.odin
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package tests_core_os_os2

import os "core:os/os2"
import "core:log"
import "core:path/filepath"
import "core:slice"
import "core:testing"
Expand All @@ -15,6 +16,11 @@ test_read_dir :: proc(t: ^testing.T) {

slice.sort_by_key(fis, proc(fi: os.File_Info) -> string { return fi.name })

if err == .Unsupported {
log.warn("os2 directory functionality is unsupported, skipping test")
return
}

testing.expect_value(t, err, nil)
testing.expect_value(t, len(fis), 2)

Expand Down

0 comments on commit 282d956

Please sign in to comment.