@@ -22,6 +22,7 @@ import "base:runtime"
2222import " core:os"
2323import " core:path/filepath"
2424import " core:testing"
25+ import " core:strings"
2526import " root:errors"
2627import om " root:ordered_map"
2728
@@ -411,15 +412,33 @@ test_any_glob_match_abs_or_rel :: proc(t: ^testing.T) {
411412 } else {
412413 externs := []string {
413414 " C:/temp/banana/stddef.h" ,
415+ " D:/temp/banana/stddef.h" ,
414416 " ../test_data/alpro.h" ,
415417 " now.h" ,
416418 }
417419
418420 rel_value, rel_err := filepath.rel (os.dir (rune_file_name), " C:\\ temp\\ banana\\ stddef.h" )
419- if !testing.expectf (t, rel_err == .None, " test value error: {} (dir=\" {}\" base=\" {}\" )" , rel_err, os.dir (rune_file_name), rune_file_name) do return
420- value, repl_sep_err = filepath.replace_separators (rel_value, ' /' )
421- delete (rel_value)
422- if !testing.expect_value (t, repl_sep_err, runtime.Allocator_Error.None) do return
421+ if rel_err == .None {
422+ value, repl_sep_err = filepath.replace_separators (rel_value, ' /' )
423+ delete (rel_value)
424+ if !testing.expect_value (t, repl_sep_err, runtime.Allocator_Error.None) do return
425+ } else {
426+ value = strings.clone (" C:/temp/banana/stddef.h" )
427+ }
428+
429+ result = any_glob_match_abs_or_rel (rune_file_name, externs, value)
430+ delete (value)
431+
432+ testing.expectf (t, result, " \" {}\" is not in {} (base=\" {}\" )" , value, externs, rune_file_name)
433+
434+ rel_value, rel_err = filepath.rel (os.dir (rune_file_name), " D:\\ temp\\ banana\\ stddef.h" )
435+ if rel_err == .None {
436+ value, repl_sep_err = filepath.replace_separators (rel_value, ' /' )
437+ delete (rel_value)
438+ if !testing.expect_value (t, repl_sep_err, runtime.Allocator_Error.None) do return
439+ } else {
440+ value = strings.clone (" D:/temp/banana/stddef.h" )
441+ }
423442
424443 result = any_glob_match_abs_or_rel (rune_file_name, externs, value)
425444 delete (value)
@@ -438,4 +457,6 @@ test_any_glob_match_abs_or_rel :: proc(t: ^testing.T) {
438457 value = " ../test_data/now.h"
439458 result = any_glob_match_abs_or_rel (rune_file_name, externs, value)
440459 testing.expectf (t, result, " \" {}\" is not in {} (base=\" {}\" )" , value, externs, rune_file_name)
460+
461+ delete (strings.clone (" banana" ))
441462}
0 commit comments