| 29 | } |
| 30 | |
| 31 | int main() |
| 32 | { |
| 33 | auto handlers = std::make_tuple( |
| 34 | []( info<1> x ) |
| 35 | { |
| 36 | BOOST_TEST_EQ(x.value, 1); |
| 37 | return 1; |
| 38 | }, |
| 39 | []( leaf::diagnostic_details const & info ) |
| 40 | { |
| 41 | std::cout << info; |
| 42 | return 2; |
| 43 | } ); |
| 44 | |
| 45 | auto ctx = leaf::make_context(handlers); |
| 46 | |
| 47 | { |
| 48 | leaf::result<int> r1 = f(ctx); |
| 49 | BOOST_TEST(!r1); |
| 50 | |
| 51 | int r2 = ctx.handle_error<int>( |
| 52 | r1.error(), |
| 53 | std::move(handlers)); |
| 54 | BOOST_TEST_EQ(r2, 1); |
| 55 | } |
| 56 | |
| 57 | return boost::report_errors(); |
| 58 | } |
nothing calls this directly
no test coverage detected