2
0
mirror of https://github.com/boostorg/url.git synced 2026-02-15 01:22:11 +00:00
This commit is contained in:
Vinnie Falco
2021-09-11 18:43:28 -07:00
parent b57db1f14c
commit ad308be3fb
24 changed files with 1081 additions and 669 deletions

View File

@@ -12,6 +12,7 @@
#include <boost/url/url_view.hpp>
#include "test_suite.hpp"
#include <iostream>
namespace boost {
namespace urls {
@@ -135,12 +136,12 @@ public:
{
url_view uv;
BOOST_TEST_NO_THROW( uv = parse_uri(
"http://username:pass@www.boost.org:8080/x/y/z?a=b&c=3#frag"));
"http://user:pass@www.boost.org:8080/x/y/z?a=b&c=3#frag"));
url_t u(uv);
BOOST_TEST(u.encoded_origin() ==
"http://username:pass@www.boost.org:8080");
"http://user:pass@www.boost.org:8080");
BOOST_TEST(u.scheme() == "http");
BOOST_TEST(u.username() == "username");
BOOST_TEST(u.user() == "user");
BOOST_TEST(u.password() == "pass");
BOOST_TEST(u.host() == "www.boost.org");
BOOST_TEST(u.port() == "8080");
@@ -149,11 +150,41 @@ public:
BOOST_TEST(u.encoded_fragment() == "frag");
}
void
testSetScheme()
{
{
url_t u;
u = parse_uri("http://www.example.com");
u.set_scheme("");
BOOST_TEST(u.str() == "//www.example.com");
}
{
url_t u;
u = parse_uri("http:live/wire");
u.set_scheme("");
BOOST_TEST(u.str() == "live/wire");
}
{
url_t u;
u = parse_uri("http:my:adidas");
u.set_scheme("");
BOOST_TEST(u.str() == "./my:adidas");
}
{
url_t u;
u = parse_uri("http:my:adidas/");
u.set_scheme("");
BOOST_TEST(u.str() == "./my:adidas/");
}
}
void
run()
{
testSpecial();
testParts();
testSetScheme();
}
};