aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRichard Walters <rwalters@digitalstirling.com>2018-07-01 23:36:07 -0700
committerRichard Walters <rwalters@digitalstirling.com>2018-07-01 23:36:07 -0700
commit432a413f585c834d7ecd69a46443a33af40f79db (patch)
treee73f714ce722761c7482870a1acbb7dc81ffaa24 /test
parent4c662109404c79440a62888ae8babff81ce1b71e (diff)
Allow HEXDIG to include lower-case 'a'..'f'
Diffstat (limited to 'test')
-rw-r--r--test/src/UriTests.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/src/UriTests.cpp b/test/src/UriTests.cpp
index 6d59697..bb541d0 100644
--- a/test/src/UriTests.cpp
+++ b/test/src/UriTests.cpp
@@ -524,3 +524,28 @@ TEST(UriTests, ParseFromStringFragmentBarelyLegal) {
++index;
}
}
+
+TEST(UriTests, ParseFromStringPathsWithPercentEncodedCharacters) {
+ struct TestVector {
+ std::string uriString;
+ std::string pathFirstSegment;
+ };
+ const std::vector< TestVector > testVectors{
+ {"%41", "A"},
+ {"%4A", "J"},
+ {"%4a", "J"},
+ {"%bc", "\xbc"},
+ {"%Bc", "\xbc"},
+ {"%bC", "\xbc"},
+ {"%BC", "\xbc"},
+ {"%41%42%43", "ABC"},
+ {"%41%4A%43%4b", "AJCK"},
+ };
+ size_t index = 0;
+ for (const auto& testVector : testVectors) {
+ Uri::Uri uri;
+ ASSERT_TRUE(uri.ParseFromString(testVector.uriString)) << index;
+ ASSERT_EQ(testVector.pathFirstSegment, uri.GetPath()[0]);
+ ++index;
+ }
+}