AK: Tests: TestURL: Add port_int_overflow_wrap test

This commit is contained in:
Brendan Coles 2021-03-17 07:42:46 +00:00 committed by Andreas Kling
parent 10843a2c8c
commit fa28cc85e6

View file

@ -213,4 +213,12 @@ TEST_CASE(trailing_port)
EXPECT_EQ(url.port(), 8086); EXPECT_EQ(url.port(), 8086);
} }
TEST_CASE(port_int_overflow_wrap)
{
auto expected_port = 80;
URL url(String::formatted("http://example.com:{}/", (u32)((65536 * 1000) + expected_port)));
EXPECT_EQ(url.port(), expected_port);
EXPECT_EQ(url.is_valid(), true);
}
TEST_MAIN(URL) TEST_MAIN(URL)