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