Added setters for fr::URL components + ability to get whole URL

This commit is contained in:
Fred Nicolson
2019-06-25 14:53:34 +01:00
parent 134940138a
commit a515cf7c92
3 changed files with 88 additions and 4 deletions
+16
View File
@@ -72,4 +72,20 @@ TEST(URLTest, schema_parse_test)
fr::URL url2;
url2.parse("127.0.0.1:2020");
ASSERT_TRUE(url == url2);
}
TEST(URLTest, get_url_test)
{
ASSERT_EQ(fr::URL("127.0.0.1:2020").get_url(), "127.0.0.1:2020");
ASSERT_EQ(fr::URL("https://127.0.0.1:2020").get_url(), "https://127.0.0.1:2020");
ASSERT_EQ(fr::URL("https://127.0.0.1").get_url(), "https://127.0.0.1:443");
ASSERT_EQ(fr::URL("127.0.0.1/hello.php?x=10").get_url(), "127.0.0.1/hello.php?x=10");
ASSERT_EQ(fr::URL("/hello.php").get_url(), "/hello.php");
}
TEST(URLTest, test_modify_url)
{
fr::URL url("https://example.com:2020");
url.set_host("example.co.uk");
ASSERT_EQ(url.get_url(), "https://example.co.uk:2020");
}