mirror of
https://github.com/sbrow/envr.git
synced 2026-06-27 10:38:33 -04:00
refactor(odin): Fixed AI mistakes.
This commit is contained in:
26
cmd_list_test.odin
Normal file
26
cmd_list_test.odin
Normal file
@@ -0,0 +1,26 @@
|
||||
package main
|
||||
|
||||
import "core:path/filepath"
|
||||
import "core:testing"
|
||||
|
||||
@(test)
|
||||
test_filepath_base_equals_rel :: proc(t: ^testing.T) {
|
||||
cases := []string{
|
||||
"/home/user/.env",
|
||||
"/home/user/project/.envrc",
|
||||
"/tmp/foo",
|
||||
"/a/b/c/d.txt",
|
||||
}
|
||||
|
||||
for path in cases {
|
||||
dir := filepath.dir(path)
|
||||
rel, rel_err := filepath.rel(dir, path)
|
||||
testing.expect(t, rel_err == nil, "filepath.rel returned an error")
|
||||
base := filepath.base(path)
|
||||
testing.expect(
|
||||
t,
|
||||
rel == base,
|
||||
"filepath.rel(dir, path) should equal filepath.base(path)",
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user