AK: Add URLParser relative file URL test

I was debugging a different issue in Ladybird, and noticed that
completing relative file URLs with URL::complete_url didn't seem to work
right. This test case covers both the working https case, as well as the
file URL case fixed by the previous commit.
This commit is contained in:
Valtteri Koskivuori 2023-06-18 02:43:11 +03:00 committed by Andreas Kling
parent 838d586b25
commit 5e5493e334
Notes: sideshowbarker 2024-07-16 23:38:54 +09:00

View file

@ -184,6 +184,12 @@ TEST_CASE(file_url_serialization)
EXPECT_EQ(URL("file:///my/file#fragment"sv).serialize(), "file:///my/file#fragment");
}
TEST_CASE(file_url_relative)
{
EXPECT_EQ(URL("https://vkoskiv.com/index.html"sv).complete_url("/static/foo.js"sv).serialize(), "https://vkoskiv.com/static/foo.js");
EXPECT_EQ(URL("file:///home/vkoskiv/test/index.html"sv).complete_url("/static/foo.js"sv).serialize(), "file:///home/vkoskiv/test/static/foo.js");
}
TEST_CASE(about_url)
{
URL url("about:blank"sv);