aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRichard Walters <rwalters@digitalstirling.com>2018-07-04 19:58:11 -0700
committerRichard Walters <rwalters@digitalstirling.com>2018-07-04 19:58:11 -0700
commitaf8ff1ec7bc115f714bc332263c379bf9d6c650e (patch)
tree95f379b56e41d87dd3bb7a50d4438763fbdc1976 /test
parent69d6838899bf3fe86a81960c574202acfb5f0f77 (diff)
Percent-encode if necessary any elements when generating strings
Diffstat (limited to 'test')
-rw-r--r--test/src/UriTests.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/src/UriTests.cpp b/test/src/UriTests.cpp
index 6e93a4e..2e5f2d6 100644
--- a/test/src/UriTests.cpp
+++ b/test/src/UriTests.cpp
@@ -796,6 +796,13 @@ TEST(UriTests, GenerateString) {
{"http", "bob", "", false, 0, {}, true, "foobar", false, "", "http://bob@?foobar"},
{"", "bob", "", false, 0, {}, true, "foobar", false, "", "//bob@?foobar"},
{"", "bob", "", false, 0, {}, false, "", false, "", "//bob@"},
+
+ // percent-encoded character test vectors
+ {"http", "b b", "www.example.com", true, 8080, {"", "abc", "def"}, true, "foobar", true, "ch2", "http://b%20b@www.example.com:8080/abc/def?foobar#ch2"},
+ {"http", "bob", "www.e ample.com", true, 8080, {"", "abc", "def"}, true, "foobar", true, "ch2", "http://bob@www.e%20ample.com:8080/abc/def?foobar#ch2"},
+ {"http", "bob", "www.example.com", true, 8080, {"", "a c", "def"}, true, "foobar", true, "ch2", "http://bob@www.example.com:8080/a%20c/def?foobar#ch2"},
+ {"http", "bob", "www.example.com", true, 8080, {"", "abc", "def"}, true, "foo ar", true, "ch2", "http://bob@www.example.com:8080/abc/def?foo%20ar#ch2"},
+ {"http", "bob", "www.example.com", true, 8080, {"", "abc", "def"}, true, "foobar", true, "c 2", "http://bob@www.example.com:8080/abc/def?foobar#c%202"},
};
size_t index = 0;
for (const auto& testVector : testVectors) {