mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 08:17:34 +00:00
AK: Implement a way to resolve relative paths lexically
This commit is contained in:
parent
24e7196158
commit
50ad294527
3 changed files with 22 additions and 0 deletions
|
@ -128,6 +128,19 @@ TEST_CASE(trailing_slash)
|
|||
EXPECT_EQ(path.parts_view().size(), 2u);
|
||||
}
|
||||
|
||||
TEST_CASE(resolve_absolute_path)
|
||||
{
|
||||
EXPECT_EQ(LexicalPath::absolute_path("/home/anon", "foo.txt"), "/home/anon/foo.txt");
|
||||
EXPECT_EQ(LexicalPath::absolute_path("/home/anon/", "foo.txt"), "/home/anon/foo.txt");
|
||||
EXPECT_EQ(LexicalPath::absolute_path("/home/anon", "././foo.txt"), "/home/anon/foo.txt");
|
||||
EXPECT_EQ(LexicalPath::absolute_path("/home/anon/quux", "../foo.txt"), "/home/anon/foo.txt");
|
||||
EXPECT_EQ(LexicalPath::absolute_path("/home/anon/quux", "../test/foo.txt"), "/home/anon/test/foo.txt");
|
||||
EXPECT_EQ(LexicalPath::absolute_path("quux", "../test/foo.txt"), "test/foo.txt");
|
||||
EXPECT_EQ(LexicalPath::absolute_path("quux", "../../test/foo.txt"), "../test/foo.txt");
|
||||
EXPECT_EQ(LexicalPath::absolute_path("quux/bar", "../../test/foo.txt"), "test/foo.txt");
|
||||
EXPECT_EQ(LexicalPath::absolute_path("quux/bar/", "../../test/foo.txt"), "test/foo.txt");
|
||||
}
|
||||
|
||||
TEST_CASE(has_extension)
|
||||
{
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue