mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 07:38:48 +00:00
os/os2: add get_executable_path and get_executable_directory
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
package tests_core_os_os2
|
||||
|
||||
import os "core:os/os2"
|
||||
import "core:log"
|
||||
import "core:path/filepath"
|
||||
import "core:testing"
|
||||
import "core:strings"
|
||||
|
||||
@(test)
|
||||
test_executable :: proc(t: ^testing.T) {
|
||||
path, err := os.get_executable_path(context.allocator)
|
||||
defer delete(path)
|
||||
|
||||
log.infof("executable path: %q", path)
|
||||
|
||||
// NOTE: some sanity checks that should always be the case, at least in the CI.
|
||||
|
||||
testing.expect_value(t, err, nil)
|
||||
testing.expect(t, len(path) > 0)
|
||||
testing.expect(t, filepath.is_abs(path))
|
||||
testing.expectf(t, strings.contains(path, filepath.base(os.args[0])), "expected the executable path to contain the base of os.args[0] which is %q", filepath.base(os.args[0]))
|
||||
}
|
||||
Reference in New Issue
Block a user