| 229 | #endif |
| 230 | |
| 231 | int main() |
| 232 | { |
| 233 | { |
| 234 | nlohmann::ordered_json j; |
| 235 | leaf::try_handle_all( |
| 236 | [] |
| 237 | { |
| 238 | return fail(); |
| 239 | }, |
| 240 | [&j](leaf::diagnostic_info const & di, my_error<1> const * e1) |
| 241 | { |
| 242 | BOOST_TEST(e1 != nullptr); |
| 243 | output_encoder e{j}; |
| 244 | di.serialize_to(e); |
| 245 | } |
| 246 | ); |
| 247 | std::cout << __LINE__ << " diagnostic_info JSON output:\n" << std::setw(2) << j << std::endl; |
| 248 | check_diagnostic_info(j, true); |
| 249 | } |
| 250 | |
| 251 | { |
| 252 | nlohmann::ordered_json j; |
| 253 | leaf::try_handle_all( |
| 254 | [] |
| 255 | { |
| 256 | return fail(); |
| 257 | }, |
| 258 | [&j](leaf::diagnostic_details const & dd, my_error<1> const * e1) |
| 259 | { |
| 260 | BOOST_TEST(e1 != nullptr); |
| 261 | output_encoder e{j}; |
| 262 | dd.serialize_to(e); |
| 263 | } |
| 264 | ); |
| 265 | std::cout << __LINE__ << " diagnostic_details JSON output:\n" << std::setw(2) << j << std::endl; |
| 266 | check_diagnostic_details(j, true); |
| 267 | } |
| 268 | |
| 269 | #ifndef BOOST_LEAF_NO_EXCEPTIONS |
| 270 | { |
| 271 | nlohmann::ordered_json j; |
| 272 | leaf::try_catch( |
| 273 | [] |
| 274 | { |
| 275 | leaf_throw(); |
| 276 | }, |
| 277 | [&j](leaf::diagnostic_info const & di, my_error<1> const * e1) |
| 278 | { |
| 279 | BOOST_TEST(e1 != nullptr); |
| 280 | output_encoder e{j}; |
| 281 | di.serialize_to(e); |
| 282 | } |
| 283 | ); |
| 284 | std::cout << __LINE__ << " leaf_throw diagnostic_info JSON output:\n" << std::setw(2) << j << std::endl; |
| 285 | check_diagnostic_info(j, true); |
| 286 | check_exception(j); |
| 287 | } |
| 288 |
nothing calls this directly
no test coverage detected