You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My library technically supports the wider syntax URI-reference which is either a URI or relative-ref per RFC 3986 section 4.1. Although scheme is required for URI, it is not for relative-ref. All the test vectors in ParseFromStringHostBarelyLegal are valid relative-ref examples.
TEST(UriTests, ParseFromStringHostBarelyLegal) {
struct TestVector {
std::string uriString;
std::string host;
};
const std::vector< TestVector > testVectors{
{"//%41/", "a"},
{"///", ""},
{"//!/", "!"},
{"//'/", "'"},
{"//(/", "("},
{"//;/", ";"},
{"//1.2.3.4/", "1.2.3.4"},
{"//[v7.:]/", "v7.:"},
{"//[v7.aB]/", "v7.aB"},
};
size_t index = 0;
for (const auto& testVector : testVectors) {
UriParser::Uri uri;
ASSERT_TRUE(uri.ParseFromString(testVector.uriString)) << index;
std::cout<<index<<std::endl;
ASSERT_EQ(testVector.host, uri.GetHost());
++index;
}
}
I have a concern regarding this test, URI must have non empty scheme ,but ur code is causing this string to parse successfully.
The text was updated successfully, but these errors were encountered: