MCPcopy Create free account
hub / github.com/apache/qpid-proton / test_addr

Function test_addr

cpp/src/connect_config_test.cpp:100–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98}
99
100void test_addr() {
101 connection_options opts;
102 ASSERT_EQUAL("foo:bar", configure(opts, R"({ "host":"foo", "port":"bar" })"));
103 ASSERT_EQUAL("foo:1234", configure(opts, R"({ "host":"foo", "port":"1234" })"));
104 ASSERT_EQUAL("localhost:amqps", configure(opts, "{}"));
105 ASSERT_EQUAL("localhost:amqp", configure(opts, R"({"scheme":"amqp"})"));
106 ASSERT_EQUAL("foo:bar", configure(opts, R"(
107{ "host":"foo", /* inline comment */"port":"bar" // end of line comment
108}
109 )"));
110
111 ASSERT_THROWS_MSG(error, "'scheme' must be", configure(opts, R"({"scheme":"bad"})"));
112 ASSERT_THROWS_MSG(error, "'scheme' expected string, found boolean", configure(opts, R"({"scheme":true})"));
113 ASSERT_THROWS_MSG(error, "'port' expected string or uint, found boolean", configure(opts, R"({"port":true})"));
114 ASSERT_THROWS_MSG(error, "'host' expected string, found boolean", configure(opts, R"({"host":true})"));
115}
116
117void test_invalid_config() {
118 connection_options opts;

Callers 1

mainFunction · 0.85

Calls 1

configureFunction · 0.85

Tested by

no test coverage detected