mirror of
https://github.com/gechandesu/runcmd.git
synced 2026-01-02 13:49:34 +03:00
25 lines
499 B
V
25 lines
499 B
V
import runcmd
|
|
import os
|
|
import io.util
|
|
|
|
fn make_temp_file() !string {
|
|
_, path := util.temp_file()!
|
|
os.chmod(path, 0o700)!
|
|
dump(path)
|
|
return path
|
|
}
|
|
|
|
fn test_lookup() {
|
|
path := make_temp_file()!
|
|
defer { os.rm(path) or {} }
|
|
assert os.is_abs_path(runcmd.look_path(path)!)
|
|
assert runcmd.look_path('/nonexistent') or { '' } == ''
|
|
assert runcmd.look_path('env')! == '/usr/bin/env'
|
|
}
|
|
|
|
fn test_is_present() {
|
|
path := make_temp_file()!
|
|
defer { os.rm(path) or {} }
|
|
assert runcmd.is_present(path)
|
|
}
|