mirror of
https://github.com/sbrow/envr.git
synced 2026-06-27 10:38:33 -04:00
refactor: Fixed the rest of the (tested) leaks.
This commit is contained in:
@@ -5,22 +5,14 @@ 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",
|
||||
}
|
||||
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)
|
||||
rel, rel_err := filepath.rel(dir, path, context.temp_allocator)
|
||||
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)",
|
||||
)
|
||||
testing.expect(t, rel == base, "filepath.rel(dir, path) should equal filepath.base(path)")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user