summaryrefslogtreecommitdiff
path: root/Tests/AK/TestURL.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/AK/TestURL.cpp')
-rw-r--r--Tests/AK/TestURL.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/Tests/AK/TestURL.cpp b/Tests/AK/TestURL.cpp
index a9fbf426a3..66569e9a7e 100644
--- a/Tests/AK/TestURL.cpp
+++ b/Tests/AK/TestURL.cpp
@@ -392,3 +392,17 @@ TEST_CASE(unicode)
EXPECT(url.query().is_null());
EXPECT(url.fragment().is_null());
}
+
+TEST_CASE(complete_file_url_with_base)
+{
+ URL url { "file:///home/index.html" };
+ EXPECT(url.is_valid());
+ EXPECT_EQ(url.path(), "/home/index.html");
+ EXPECT_EQ(url.paths().size(), 2u);
+ EXPECT_EQ(url.paths()[0], "home");
+ EXPECT_EQ(url.paths()[1], "index.html");
+
+ auto sub_url = url.complete_url("js/app.js");
+ EXPECT(sub_url.is_valid());
+ EXPECT_EQ(sub_url.path(), "/home/js/app.js");
+}