mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 12:19:54 +00:00
AK: Make LexicalPath::relative_path() fallible
This commit is contained in:
parent
f026d495cd
commit
31bf40b659
Notes:
github-actions[bot]
2024-11-09 19:43:30 +00:00
Author: https://github.com/stasoid
Commit: 31bf40b659
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1918
Reviewed-by: https://github.com/ADKaster ✅
8 changed files with 12 additions and 14 deletions
|
@ -17,8 +17,8 @@ TEST_CASE(relative_path)
|
|||
EXPECT_EQ(LexicalPath::relative_path("/tmp/abc.txt"sv, "/"sv), "tmp/abc.txt"sv);
|
||||
EXPECT_EQ(LexicalPath::relative_path("/tmp/abc.txt"sv, "/usr"sv), "../tmp/abc.txt"sv);
|
||||
|
||||
EXPECT_EQ(LexicalPath::relative_path("/tmp/foo.txt"sv, "tmp"sv), ""sv);
|
||||
EXPECT_EQ(LexicalPath::relative_path("tmp/foo.txt"sv, "/tmp"sv), ""sv);
|
||||
EXPECT(!LexicalPath::relative_path("/tmp/foo.txt"sv, "tmp"sv).has_value());
|
||||
EXPECT(!LexicalPath::relative_path("tmp/foo.txt"sv, "/tmp"sv).has_value());
|
||||
|
||||
EXPECT_EQ(LexicalPath::relative_path("/tmp/foo/bar/baz.txt"sv, "/tmp/bar/foo/"sv), "../../foo/bar/baz.txt"sv);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue