Tests: Add tests for LexicalPath dirname handling

This commit is contained in:
Tim Schumacher 2021-05-27 14:03:55 +02:00 committed by Ali Mohammad Pur
parent 0aaa992c1c
commit e87a9a7f9f
Notes: sideshowbarker 2024-07-18 17:18:34 +09:00

View file

@ -78,3 +78,11 @@ TEST_CASE(relative_path)
EXPECT_EQ(LexicalPath::relative_path("/tmp/foo.txt", "tmp"), String {});
EXPECT_EQ(LexicalPath::relative_path("tmp/foo.txt", "/tmp"), String {});
}
TEST_CASE(dirname)
{
EXPECT_EQ(LexicalPath(".").dirname(), ".");
EXPECT_EQ(LexicalPath("/").dirname(), "/");
EXPECT_EQ(LexicalPath("abc.txt").dirname(), ".");
EXPECT_EQ(LexicalPath("/abc.txt").dirname(), "/");
}