mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:57:35 +00:00
AK: Strip leading/trailing C0-control-or-space in URLs correctly
We have to stop scanning once we hit a non-strippable character. Add some tests to cover this.
This commit is contained in:
parent
468bb54677
commit
c0d1a75881
2 changed files with 27 additions and 2 deletions
|
@ -307,3 +307,24 @@ TEST_CASE(complete_url)
|
|||
|
||||
EXPECT(base_url.complete_url("../index.html#fragment").equals(base_url));
|
||||
}
|
||||
|
||||
TEST_CASE(leading_whitespace)
|
||||
{
|
||||
URL url { " https://foo.com/" };
|
||||
EXPECT(url.is_valid());
|
||||
EXPECT_EQ(url.to_string(), "https://foo.com/");
|
||||
}
|
||||
|
||||
TEST_CASE(trailing_whitespace)
|
||||
{
|
||||
URL url { "https://foo.com/ " };
|
||||
EXPECT(url.is_valid());
|
||||
EXPECT_EQ(url.to_string(), "https://foo.com/");
|
||||
}
|
||||
|
||||
TEST_CASE(leading_and_trailing_whitespace)
|
||||
{
|
||||
URL url { " https://foo.com/ " };
|
||||
EXPECT(url.is_valid());
|
||||
EXPECT_EQ(url.to_string(), "https://foo.com/");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue