| 124 | } |
| 125 | |
| 126 | void test_invalid_json() { |
| 127 | connection_options opts; |
| 128 | // ancient versions of jsoncpp use a generic error message for parse errors |
| 129 | // in the exception, and print the detailed message to stderr |
| 130 | // https://github.com/open-source-parsers/jsoncpp/commit/6b10ce8c0d07ea07861e82f65f17d9fd6abd658d |
| 131 | if (std::make_tuple(JSONCPP_VERSION_MAJOR, JSONCPP_VERSION_MINOR) < std::make_tuple(1, 7)) { |
| 132 | ASSERT_THROWS_MSG(proton::error, "reader error", configure(opts, "{")); |
| 133 | ASSERT_THROWS_MSG(proton::error, "reader error", configure(opts, "")); |
| 134 | ASSERT_THROWS_MSG(proton::error, "reader error", configure(opts, R"({ "user" : "x" "host" : "y"})")); |
| 135 | } else { |
| 136 | ASSERT_THROWS_MSG(proton::error, "Missing '}'", configure(opts, "{")); |
| 137 | ASSERT_THROWS_MSG(proton::error, "Syntax error", configure(opts, "")); |
| 138 | ASSERT_THROWS_MSG(proton::error, "Missing ','", configure(opts, R"({ "user":"x" "host":"y"})")); |
| 139 | } |
| 140 | } |
| 141 | |
| 142 | class test_almost_default_connect : public test_handler { |
| 143 | public: |