Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add tests to issue 161
  • Loading branch information
ky committed Dec 7, 2012
commit f77a94f97703b58afaa6501a842599689645d0ce
4 changes: 2 additions & 2 deletions include/network/uri/accessors.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ struct key_value_sequence
{
query = pair >> *((boost::spirit::qi::lit(';') | '&') >> pair);
pair = key >> -('=' >> value);
key = spirit::qi::char_("a-zA-Z_") >> *spirit::qi::char_("-+.~a-zA-Z_0-9/%");
value = *spirit::qi::char_("-+.~a-zA-Z_0-9/%");
key = boost::spirit::qi::char_("a-zA-Z_") >> *boost::spirit::qi::char_("-+.~a-zA-Z_0-9/%");
value = *boost::spirit::qi::char_("-+.~a-zA-Z_0-9/%");
}

boost::spirit::qi::rule<uri::const_iterator, Map()> query;
Expand Down
14 changes: 14 additions & 0 deletions libs/network/test/uri/uri_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -691,3 +691,17 @@ BOOST_AUTO_TEST_CASE(uri_unordered_set_test) {
BOOST_REQUIRE(!uri_set.empty());
BOOST_CHECK_EQUAL((*uri_set.begin()), network::uri("http://www.example.com/"));
}

BOOST_AUTO_TEST_CASE(issue_161_test) {
network::uri instance("http://www.example.com/path?param1=-&param2=some+plus+encoded+text&param3=~");
BOOST_REQUIRE(network::valid(instance));

std::map<std::string, std::string> queries;
network::query_map(instance, queries);
BOOST_REQUIRE_EQUAL(queries.size(), std::size_t(3));
BOOST_CHECK_EQUAL(queries["param1"], "-");
BOOST_CHECK_EQUAL(queries["param2"], "some+plus+encoded+text");
BOOST_CHECK_EQUAL(queries["param3"], "~");
BOOST_CHECK_EQUAL(network::decoded(queries["param2"]), "some plus encoded text");
}