Commit a8c4fd17 authored by Dominik Charousset's avatar Dominik Charousset

Fix URI unit tests

parent 4e34d921
...@@ -87,16 +87,17 @@ struct uri_str_builder { ...@@ -87,16 +87,17 @@ struct uri_str_builder {
uri_str_builder& query(uri::query_map map) { uri_str_builder& query(uri::query_map map) {
if (map.empty()) if (map.empty())
return *this; return *this;
auto print_kvp = [&](const uri::query_map::value_type& kvp) {
res += kvp.first;
res += '=';
res += kvp.second;
};
res += '?'; res += '?';
auto i = map.begin(); auto i = map.begin();
res += i->first; print_kvp(*i);
res += '='; for (++i; i != map.end(); ++i) {
res += i->second;
for (; i != map.end(); ++i) {
res += '&'; res += '&';
res += i->first; print_kvp(*i);
res += '=';
res += i->second;
} }
return *this; return *this;
} }
...@@ -279,7 +280,7 @@ CAF_TEST(builder construction) { ...@@ -279,7 +280,7 @@ CAF_TEST(builder construction) {
.path("file 1") .path("file 1")
.fragment("[42]") .fragment("[42]")
.make(); .make();
CAF_CHECK_EQUAL(escaped, "hi%20there://it%27s@me%21/file%201#%5B42%5D"); CAF_CHECK_EQUAL(escaped, "hi%20there://it%27s@me%2F/file%201#%5B42%5D");
} }
#define ROUNDTRIP(str) CAF_CHECK_EQUAL(str##_u, str) #define ROUNDTRIP(str) CAF_CHECK_EQUAL(str##_u, str)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment