"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "test/test.cpp" between
uriparser-0.9.4.tar.xz and uriparser-0.9.5.tar.xz

About: uriparser is a strictly RFC 3986 compliant URI parsing library (with Unicode support).

test.cpp  (uriparser-0.9.4.tar.xz):test.cpp  (uriparser-0.9.5.tar.xz)
skipping to change at line 309 skipping to change at line 309
// Relative // Relative
ASSERT_TRUE(0 == uriParseUriA(&stateA, "one/two/three")); ASSERT_TRUE(0 == uriParseUriA(&stateA, "one/two/three"));
ASSERT_TRUE(!uriA.absolutePath); ASSERT_TRUE(!uriA.absolutePath);
uriFreeUriMembersA(&uriA); uriFreeUriMembersA(&uriA);
ASSERT_TRUE(0 == uriParseUriA(&stateA, "/one/two/three")); ASSERT_TRUE(0 == uriParseUriA(&stateA, "/one/two/three"));
ASSERT_TRUE(uriA.absolutePath); ASSERT_TRUE(uriA.absolutePath);
uriFreeUriMembersA(&uriA); uriFreeUriMembersA(&uriA);
ASSERT_TRUE(0 == uriParseUriA(&stateA, "//user:pass@localhost/one /two/three")); ASSERT_TRUE(0 == uriParseUriA(&stateA, "//user:pass@localhost/one /two/three"));
uriFreeUriMembersA(&uriA); uriFreeUriMembersA(&uriA);
// ANSI and Unicode // Both narrow and wide string version
ASSERT_TRUE(0 == uriParseUriA(&stateA, "http://www.example.com/") ); ASSERT_TRUE(0 == uriParseUriA(&stateA, "http://www.example.com/") );
uriFreeUriMembersA(&uriA); uriFreeUriMembersA(&uriA);
ASSERT_TRUE(0 == uriParseUriW(&stateW, L"http://www.example.com/" )); ASSERT_TRUE(0 == uriParseUriW(&stateW, L"http://www.example.com/" ));
uriFreeUriMembersW(&uriW); uriFreeUriMembersW(&uriW);
// Real life examples // Real life examples
ASSERT_TRUE(0 == uriParseUriA(&stateA, "http://sourceforge.net/pr ojects/uriparser/")); ASSERT_TRUE(0 == uriParseUriA(&stateA, "http://sourceforge.net/pr ojects/uriparser/"));
uriFreeUriMembersA(&uriA); uriFreeUriMembersA(&uriA);
ASSERT_TRUE(0 == uriParseUriA(&stateA, "http://sourceforge.net/pr oject/platformdownload.php?group_id=182840")); ASSERT_TRUE(0 == uriParseUriA(&stateA, "http://sourceforge.net/pr oject/platformdownload.php?group_id=182840"));
uriFreeUriMembersA(&uriA); uriFreeUriMembersA(&uriA);
skipping to change at line 1092 skipping to change at line 1092
// Backward compatibility (feature request #4, RFC3986 5.4.2) // Backward compatibility (feature request #4, RFC3986 5.4.2)
ASSERT_TRUE(testAddBaseHelper(L"http://a/b/c/d;p?q", L"http:g", L "http:g", false)); ASSERT_TRUE(testAddBaseHelper(L"http://a/b/c/d;p?q", L"http:g", L "http:g", false));
ASSERT_TRUE(testAddBaseHelper(L"http://a/b/c/d;p?q", L"http:g", L "http://a/b/c/g", true)); ASSERT_TRUE(testAddBaseHelper(L"http://a/b/c/d;p?q", L"http:g", L "http://a/b/c/g", true));
ASSERT_TRUE(testAddBaseHelper(L"http://a/b/c/d;p?q", L"http:g?q#f ", L"http://a/b/c/g?q#f", true)); ASSERT_TRUE(testAddBaseHelper(L"http://a/b/c/d;p?q", L"http:g?q#f ", L"http://a/b/c/g?q#f", true));
ASSERT_TRUE(testAddBaseHelper(L"http://a/b/c/d;p?q", L"other:g?q# f", L"other:g?q#f", true)); ASSERT_TRUE(testAddBaseHelper(L"http://a/b/c/d;p?q", L"other:g?q# f", L"other:g?q#f", true));
// Bug related to absolutePath flag set despite presence of host // Bug related to absolutePath flag set despite presence of host
ASSERT_TRUE(testAddBaseHelper(L"http://a/b/c/d;p?q", L"/", L"http ://a/")); ASSERT_TRUE(testAddBaseHelper(L"http://a/b/c/d;p?q", L"/", L"http ://a/"));
ASSERT_TRUE(testAddBaseHelper(L"http://a/b/c/d;p?q", L"/g/", L"ht tp://a/g/")); ASSERT_TRUE(testAddBaseHelper(L"http://a/b/c/d;p?q", L"/g/", L"ht tp://a/g/"));
// GitHub issue #92
EXPECT_TRUE(testAddBaseHelper(L"http://a/b/c/../d;p?q", L"../..",
L"http://a/"));
EXPECT_TRUE(testAddBaseHelper(L"http://a/b/c/../d;p?q", L"../../"
, L"http://a/"));
EXPECT_TRUE(testAddBaseHelper(L"http://a/b/../c/d;p?q", L"../..",
L"http://a/"));
EXPECT_TRUE(testAddBaseHelper(L"http://a/b/../c/d;p?q", L"../../"
, L"http://a/"));
EXPECT_TRUE(testAddBaseHelper(L"http://a/../b/c/d;p?q", L"../..",
L"http://a/"));
EXPECT_TRUE(testAddBaseHelper(L"http://a/../b/c/d;p?q", L"../../"
, L"http://a/"));
EXPECT_TRUE(testAddBaseHelper(L"http://a/b/c/d;p?q", L"../../..",
L"http://a/"));
EXPECT_TRUE(testAddBaseHelper(L"http://a/b/c/d;p?q", L"../../../"
, L"http://a/"));
} }
namespace { namespace {
bool testToStringHelper(const wchar_t * text) { bool testToStringHelper(const wchar_t * text) {
// Parse // Parse
UriParserStateW state; UriParserStateW state;
UriUriW uri; UriUriW uri;
state.uri = &uri; state.uri = &uri;
int res = uriParseUriW(&state, text); int res = uriParseUriW(&state, text);
if (res != 0) { if (res != 0) {
skipping to change at line 1471 skipping to change at line 1484
L"HTTP://%41@EXAMPLE.ORG/../a?%41#%41", L"HTTP://%41@EXAMPLE.ORG/../a?%41#%41",
L"HTTP://%41@EXAMPLE.ORG/../a?A#%41", L"HTTP://%41@EXAMPLE.ORG/../a?A#%41",
URI_NORMALIZE_QUERY)); URI_NORMALIZE_QUERY));
ASSERT_TRUE(testNormalizeSyntaxHelper( ASSERT_TRUE(testNormalizeSyntaxHelper(
L"HTTP://%41@EXAMPLE.ORG/../a?%41#%41", L"HTTP://%41@EXAMPLE.ORG/../a?%41#%41",
L"HTTP://%41@EXAMPLE.ORG/../a?%41#A", L"HTTP://%41@EXAMPLE.ORG/../a?%41#A",
URI_NORMALIZE_FRAGMENT)); URI_NORMALIZE_FRAGMENT));
} }
TEST(UriSuite, TestNormalizeSyntaxPath) {
// These are from GitHub issue #92
EXPECT_TRUE(testNormalizeSyntaxHelper(
L"http://a/b/c/../../..",
L"http://a/",
URI_NORMALIZE_PATH));
EXPECT_TRUE(testNormalizeSyntaxHelper(
L"http://a/b/../c/../..",
L"http://a/",
URI_NORMALIZE_PATH));
EXPECT_TRUE(testNormalizeSyntaxHelper(
L"http://a/b/c/../../..",
L"http://a/",
URI_NORMALIZE_PATH));
// .. and these are related
EXPECT_TRUE(testNormalizeSyntaxHelper(
L"http://a/..",
L"http://a/",
URI_NORMALIZE_PATH));
EXPECT_TRUE(testNormalizeSyntaxHelper(
L"/..",
L"/",
URI_NORMALIZE_PATH));
EXPECT_TRUE(testNormalizeSyntaxHelper(
L"http://a/..///",
L"http://a///",
URI_NORMALIZE_PATH));
EXPECT_TRUE(testNormalizeSyntaxHelper(
L"http://a/..///..",
L"http://a//",
URI_NORMALIZE_PATH));
EXPECT_TRUE(testNormalizeSyntaxHelper(
L"a/b/c/../../..",
L"",
URI_NORMALIZE_PATH));
EXPECT_TRUE(testNormalizeSyntaxHelper(
L"a/b/../../c/..",
L"",
URI_NORMALIZE_PATH));
}
TEST(UriSuite, TestNormalizeCrashBug20080224) { TEST(UriSuite, TestNormalizeCrashBug20080224) {
UriParserStateW stateW; UriParserStateW stateW;
int res; int res;
UriUriW testUri; UriUriW testUri;
stateW.uri = &testUri; stateW.uri = &testUri;
res = uriParseUriW(&stateW, L"http://example.org/abc//../def"); res = uriParseUriW(&stateW, L"http://example.org/abc//../def");
ASSERT_TRUE(res == 0); ASSERT_TRUE(res == 0);
// First call will make us owner of copied memory // First call will make us owner of copied memory
 End of changes. 3 change blocks. 
1 lines changed or deleted 64 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)