Skip to content

Commit 23c4fec

Browse files
committed
Start of glob test
1 parent bd73433 commit 23c4fec

File tree

1 file changed

+27
-3
lines changed

1 file changed

+27
-3
lines changed

tests/core/os/os2/path.odin

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package tests_core_os_os2
33
import os "core:os/os2"
44
import "core:log"
55
import "core:testing"
6+
import "core:slice"
67
import "core:strings"
78

89
@(test)
@@ -376,10 +377,33 @@ test_split_path_list :: proc(t: ^testing.T) {
376377
}
377378
}
378379

379-
@(test)
380-
test_glob :: proc(t: ^testing.T) {
381-
380+
Glob_Test :: struct {
381+
pattern: string,
382+
matches: []string,
383+
err: os.Error,
384+
}
382385

386+
glob_tests := []Glob_Test{
387+
{
388+
pattern = ODIN_ROOT + "tests/core/os/*/*.txt",
389+
matches = {},
390+
err = nil,
391+
},
392+
}
383393

394+
@(test)
395+
test_glob :: proc(t: ^testing.T) {
396+
for glob in glob_tests {
397+
files, err := os.glob(glob.pattern, context.allocator)
398+
defer {
399+
for file in files {
400+
delete(file)
401+
}
402+
delete(files)
403+
}
404+
testing.expect_value(t, err, glob.err)
384405

406+
slice.sort(files)
407+
log.infof("files: %v", files)
408+
}
385409
}

0 commit comments

Comments
 (0)