diff options
author | Sebastian Pipping <sebastian@pipping.org> | 2021-02-24 23:19:37 +0100 |
---|---|---|
committer | Sebastian Pipping <sebastian@pipping.org> | 2021-02-26 22:26:51 +0100 |
commit | fa84874d081d19b107dbc04a103183ff5d66741d (patch) | |
tree | 3618143dc21c5f6ac01adfd6b9111580d6854ae2 | |
parent | a5f1d0577f5280922d1d5a6d33083f00999e557c (diff) | |
download | uriparser-fa84874d081d19b107dbc04a103183ff5d66741d.tar.gz |
test.cpp: Add test cases from GitHub issue #92
Thanks to Dan Pape (@danpape)!
-rw-r--r-- | test/test.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/test.cpp b/test/test.cpp index 9a189f9..2ffcf42 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -1098,6 +1098,19 @@ TEST(UriSuite, TestAddBase) { // 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"/g/", L"http://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 { @@ -1477,6 +1490,22 @@ TEST(UriSuite, TestNormalizeSyntaxComponents) { 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)); +} + TEST(UriSuite, TestNormalizeCrashBug20080224) { UriParserStateW stateW; int res; |