mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-08 00:28:49 +00:00
Haiku: add posix tests
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
#+build linux, darwin, freebsd, openbsd, netbsd
|
||||
#+build linux, darwin, freebsd, openbsd, netbsd, haiku
|
||||
package tests_core_posix
|
||||
|
||||
import "core:log"
|
||||
@@ -65,8 +65,17 @@ test_dirent :: proc(t: ^testing.T) {
|
||||
for entry in entries {
|
||||
defer posix.free(entry)
|
||||
|
||||
if entry.d_type != .REG {
|
||||
continue
|
||||
when ODIN_OS == .Haiku {
|
||||
stat: posix.stat_t
|
||||
posix.stat(cstring(raw_data(entry.d_name[:])), &stat)
|
||||
|
||||
if !posix.S_ISREG(stat.st_mode) {
|
||||
continue
|
||||
}
|
||||
} else {
|
||||
if entry.d_type != .REG {
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
name := string(cstring(raw_data(entry.d_name[:])))
|
||||
@@ -86,8 +95,17 @@ test_dirent :: proc(t: ^testing.T) {
|
||||
break
|
||||
}
|
||||
|
||||
if entry.d_type != .REG {
|
||||
continue
|
||||
when ODIN_OS == .Haiku {
|
||||
stat: posix.stat_t
|
||||
posix.stat(cstring(raw_data(entry.d_name[:])), &stat)
|
||||
|
||||
if !posix.S_ISREG(stat.st_mode) {
|
||||
continue
|
||||
}
|
||||
} else {
|
||||
if entry.d_type != .REG {
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
name := string(cstring(raw_data(entry.d_name[:])))
|
||||
@@ -140,15 +158,15 @@ test_langinfo :: proc(t: ^testing.T) {
|
||||
@(test)
|
||||
test_libgen :: proc(t: ^testing.T) {
|
||||
tests := [][3]cstring{
|
||||
{ "usr", ".", "usr" },
|
||||
{ "usr/", ".", "usr" },
|
||||
{ "", ".", "." },
|
||||
{ "/", "/", "/" },
|
||||
{ "///", "/", "/" },
|
||||
{ "/usr/", "/", "usr" },
|
||||
{ "/usr/lib", "/usr", "lib" },
|
||||
{ "//usr//lib//", "//usr", "lib" },
|
||||
{ "/home//dwc//test", "/home//dwc", "test" },
|
||||
{ "usr", ".", "usr" },
|
||||
{ "usr/", ".", "usr" },
|
||||
{ "", ".", "." },
|
||||
{ "/", "/", "/" },
|
||||
{ "///", "/", "/" },
|
||||
{ "/usr/", "/", "usr" },
|
||||
{ "/usr/lib", "/usr", "lib" },
|
||||
{ "//usr//lib//", "//usr" + ("/" when ODIN_OS == .Haiku else ""), "lib" },
|
||||
{ "/home//dwc//test", "/home//dwc" + ("/" when ODIN_OS == .Haiku else ""), "test" },
|
||||
}
|
||||
|
||||
for test in tests {
|
||||
|
||||
Reference in New Issue
Block a user