| 319 | |
| 320 | template <class R> |
| 321 | void test_void() |
| 322 | { |
| 323 | #if __cplusplus >= 201703L |
| 324 | { |
| 325 | int r = 0; |
| 326 | leaf::try_handle_all( |
| 327 | []() -> R |
| 328 | { |
| 329 | return make_error_code(errc_a::a0); |
| 330 | }, |
| 331 | [&]( leaf::match<std::error_code, leaf::category<errc_a>, leaf::category<errc_b>> code ) |
| 332 | { |
| 333 | std::error_code const & ec = code.matched; |
| 334 | BOOST_TEST_EQ(&ec.category(), &cat_errc_a()); |
| 335 | BOOST_TEST_EQ(ec, errc_a::a0); |
| 336 | r = 42; |
| 337 | }, |
| 338 | [&] |
| 339 | { |
| 340 | r = -42; |
| 341 | } ); |
| 342 | BOOST_TEST_EQ(r, 42); |
| 343 | } |
| 344 | { |
| 345 | int r = 0; |
| 346 | leaf::try_handle_all( |
| 347 | []() -> R |
| 348 | { |
| 349 | return make_error_code(errc_b::b0); |
| 350 | }, |
| 351 | [&]( leaf::match<std::error_code, leaf::category<errc_a>, leaf::category<errc_b>> code ) |
| 352 | { |
| 353 | std::error_code const & ec = code.matched; |
| 354 | BOOST_TEST_EQ(&ec.category(), &cat_errc_b()); |
| 355 | BOOST_TEST_EQ(ec, errc_b::b0); |
| 356 | r = 42; |
| 357 | }, |
| 358 | [&] |
| 359 | { |
| 360 | r = -42; |
| 361 | } ); |
| 362 | BOOST_TEST_EQ(r, 42); |
| 363 | } |
| 364 | { |
| 365 | int r = 0; |
| 366 | leaf::try_handle_all( |
| 367 | []() -> R |
| 368 | { |
| 369 | return make_error_code(errc_b::b0); |
| 370 | }, |
| 371 | [&]( leaf::match<std::error_code, leaf::category<errc_a>, errc_b::b0> code ) |
| 372 | { |
| 373 | std::error_code const & ec = code.matched; |
| 374 | BOOST_TEST_EQ(&ec.category(), &cat_errc_b()); |
| 375 | BOOST_TEST_EQ(ec, errc_b::b0); |
| 376 | r = 42; |
| 377 | }, |
| 378 | [&] |
nothing calls this directly
no test coverage detected