From af8ff1ec7bc115f714bc332263c379bf9d6c650e Mon Sep 17 00:00:00 2001
From: Richard Walters <rwalters@digitalstirling.com>
Date: Wed, 4 Jul 2018 19:58:11 -0700
Subject: Percent-encode if necessary any elements when generating strings

---
 test/src/UriTests.cpp | 7 +++++++
 1 file changed, 7 insertions(+)

(limited to 'test')

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) {
-- 
cgit v1.2.3