aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRichard Walters <rwalters@digitalstirling.com>2018-07-02 22:46:12 -0700
committerRichard Walters <rwalters@digitalstirling.com>2018-07-02 22:46:12 -0700
commit4cadf8d3bceb7a1bf419a44503072c3bce9913a7 (patch)
tree6b12a52f2bc6aebdc208fb8311061a8e4c5c3888 /test
parentda0d3dc2ad7c3339c9b31b3c54e16d5fd8902b2f (diff)
Recognize special case of absolute URI with empty path
Such a URI should be considered equivalent to a path of "/" because in both cases the path is an absolute path.
Diffstat (limited to 'test')
-rw-r--r--test/src/UriTests.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/src/UriTests.cpp b/test/src/UriTests.cpp
index fcd6309..897047d 100644
--- a/test/src/UriTests.cpp
+++ b/test/src/UriTests.cpp
@@ -646,3 +646,13 @@ TEST(UriTests, ConstructNormalizeAndCompareEquivalentUris) {
uri2.NormalizePath();
ASSERT_EQ(uri1, uri2);
}
+
+TEST(UriTests, EmptyPathInUriWithAuthorityIsEquivalentToSlashOnlyPath) {
+ Uri::Uri uri1, uri2;
+ ASSERT_TRUE(uri1.ParseFromString("http://example.com"));
+ ASSERT_TRUE(uri2.ParseFromString("http://example.com/"));
+ ASSERT_EQ(uri1, uri2);
+ ASSERT_TRUE(uri1.ParseFromString("urn:"));
+ ASSERT_TRUE(uri2.ParseFromString("urn:/"));
+ ASSERT_EQ(uri1, uri2);
+}