aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
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;
+ }
+}