MCPcopy Create free account
hub / github.com/boostorg/leaf / check_diagnostic_info

Function check_diagnostic_info

test/boost_json_encoder_test.cpp:136–153  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

134#endif
135
136void check_diagnostic_info(boost::json::value const & j, bool has_source_location)
137{
138 BOOST_TEST(boost::json::value_to<int>(j.at("boost::leaf::error_id")) > 0);
139
140 auto const & e1j = j.at("my_error<1>");
141 BOOST_TEST_EQ(boost::json::value_to<int>(e1j.at("code")), 1);
142 BOOST_TEST_EQ(boost::json::value_to<std::string>(e1j.at("message")), "error one");
143
144 if( has_source_location )
145 {
146 auto const & loc = j.at("boost::leaf::e_source_location");
147 BOOST_TEST(!boost::json::value_to<std::string>(loc.at("file")).empty());
148 BOOST_TEST(boost::json::value_to<int>(loc.at("line")) > 0);
149 BOOST_TEST(!boost::json::value_to<std::string>(loc.at("function")).empty());
150 }
151
152 BOOST_TEST(j.as_object().find("my_error<2>") == j.as_object().end());
153}
154
155void check_diagnostic_details(boost::json::value const & j, bool has_source_location)
156{

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected