mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-06 09:36:08 +00:00
AK: Implement a way to resolve relative paths lexically
This commit is contained in:
parent
24e7196158
commit
50ad294527
Notes:
sideshowbarker
2024-07-18 02:50:33 +09:00
Author: https://github.com/BenWiederhake
Commit: 50ad294527
Pull-request: https://github.com/SerenityOS/serenity/pull/10420
Reviewed-by: https://github.com/petelliott ✅
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