aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRichard Walters <rwalters@digitalstirling.com>2018-07-02 21:11:01 -0700
committerRichard Walters <rwalters@digitalstirling.com>2018-07-02 21:11:01 -0700
commit6974150a2c6b3b4e0fa278b08de8b2647d2c95ed (patch)
treeb36d809b21c95d9659ca17c17504a06ee3fa2080 /test
parenta32396b98cad2abc6c3fbf15a2fe1a2eaa3c8e91 (diff)
Add NormalizePath method
Diffstat (limited to 'test')
-rw-r--r--test/src/UriTests.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/src/UriTests.cpp b/test/src/UriTests.cpp
index 4242885..cbc8b8a 100644
--- a/test/src/UriTests.cpp
+++ b/test/src/UriTests.cpp
@@ -584,3 +584,22 @@ TEST(UriTests, ParseFromStringPathsWithPercentEncodedCharacters) {
++index;
}
}
+
+TEST(UriTests, NormalizePath) {
+ struct TestVector {
+ std::string uriString;
+ std::vector< std::string > normalizedPathSegments;
+ };
+ const std::vector< TestVector > testVectors{
+ {"/a/b/c/./../../g", {"", "a", "g"}},
+ {"mid/content=5/../6", {"mid", "6"}},
+ };
+ size_t index = 0;
+ for (const auto& testVector : testVectors) {
+ Uri::Uri uri;
+ ASSERT_TRUE(uri.ParseFromString(testVector.uriString)) << index;
+ uri.NormalizePath();
+ ASSERT_EQ(testVector.normalizedPathSegments, uri.GetPath());
+ ++index;
+ }
+}