- Fix to Path handling c:\foo and \home parent. #2569

This commit is contained in:
Christoffer Lerno
2025-11-08 23:42:47 +01:00
parent ffc65bcbf4
commit 52ececba37
3 changed files with 21 additions and 0 deletions

View File

@@ -34,6 +34,13 @@ fn void test_parent()
p = path::new(mem, "/a/b/c", path_env: PathEnv.WIN32)!!;
assert(p.parent().str_view()!! == `\a\b`);
p.free();
p = path::new(mem, "/a/", path_env: PathEnv.POSIX)!!;
assert(p.parent().str_view()!! == "/");
p.free();
p = path::new(mem, `C:\foo`, path_env: WIN32)!!;
assert(p.parent().str_view()!! == `C:\`);
assert(@catch(p.parent().parent()));
p.free();
}
fn void test_path_normalized() => mem::@scoped(tmem)