mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:17:45 +00:00
AK: Make LexicalPath handle relative paths correctly
Previously LexicalPath would consider "." and ".." as equivalent to "/". This is not true though.
This commit is contained in:
parent
ebb1d9740e
commit
c99fd217e2
2 changed files with 5 additions and 1 deletions
|
@ -24,12 +24,16 @@ TEST_CASE(basic)
|
|||
EXPECT_EQ(path.parts().size(), 3u);
|
||||
EXPECT_EQ(path.parts(), Vector<String>({ "abc", "def", "ghi.txt" }));
|
||||
EXPECT_EQ(path.string(), "/abc/def/ghi.txt");
|
||||
EXPECT_EQ(LexicalPath(".").string(), ".");
|
||||
EXPECT_EQ(LexicalPath("..").string(), "..");
|
||||
}
|
||||
|
||||
TEST_CASE(dotdot_coalescing)
|
||||
{
|
||||
EXPECT_EQ(LexicalPath("/home/user/../../not/home").string(), "/not/home");
|
||||
EXPECT_EQ(LexicalPath("/../../../../").string(), "/");
|
||||
EXPECT_EQ(LexicalPath("./../../../../").string(), "../../../..");
|
||||
EXPECT_EQ(LexicalPath("../../../../../").string(), "../../../../..");
|
||||
}
|
||||
|
||||
TEST_CASE(has_extension)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue