DreamPearl commented on a change in pull request #303:
URL: https://github.com/apache/qpid-proton/pull/303#discussion_r606262167
##########
File path: cpp/src/url_test.cpp
##########
@@ -111,6 +116,54 @@ TEST_CASE("parse URL","[url]") {
"amqp", "user", "pass", "::1", "1234", "path",
"amqp://user:pass@[::1]:1234/path");
}
+ SECTION("port") {
+ CHECK("host:1234" == url("amqp://host:1234/path").host_port());
+ CHECK(5672 == url("amqp://foo/path").port_int());
+ CHECK(5671 == url("amqps://foo/path").port_int());
+ CHECK(1234 == url("amqps://foo:1234/path").port_int());
+
+ url u("amqps://foo:xyz/path");
+ url_error caught_error("");
+ try{
+ u.port_int();
+ }
+ catch(url_error& err){
+ caught_error=err;
+ }
+ CHECK(std::string("invalid port 'xyz'") ==
std::string(caught_error.what()));
+ }
+ SECTION("misc") {
+ {
+ // url copy constructor
+ url u1("amqp://foo:xyz/path");
+ url u2=u1;
+ CHECK(std::string("amqp://foo:xyz/path") == std::string(u2));
Review comment:
Thanks for the suggestion!! LGTM :) But for maintaining consistency I
kept it as `LITERAL == VARIABLE` as same as CHECK calls at the top of the file.
And yes C literals working as well. So updated that one!! Thanks!!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]