| 20 | namespace leaf = boost::leaf; |
| 21 | |
| 22 | int main() |
| 23 | { |
| 24 | errno = ENOENT; |
| 25 | #if BOOST_LEAF_CFG_STD_STRING |
| 26 | std::ostringstream ss; |
| 27 | ss << leaf::e_errno{}; |
| 28 | std::string s = ss.str(); |
| 29 | std::cout << s << std::endl; |
| 30 | #if BOOST_LEAF_CFG_STD_DIAGNOSTICS |
| 31 | BOOST_TEST_NE(s.find(std::strerror(ENOENT)), std::string::npos); |
| 32 | #endif |
| 33 | #endif |
| 34 | |
| 35 | int r = leaf::try_handle_all( |
| 36 | []() -> leaf::result<int> |
| 37 | { |
| 38 | struct reset_errno { ~reset_errno() { errno=0; } } reset; |
| 39 | return leaf::new_error( leaf::e_errno{} ); |
| 40 | }, |
| 41 | []( leaf::e_errno e ) |
| 42 | { |
| 43 | BOOST_TEST_EQ(errno, 0); |
| 44 | BOOST_TEST_EQ(e.value, ENOENT); |
| 45 | return 1; |
| 46 | }, |
| 47 | [] |
| 48 | { |
| 49 | return 2; |
| 50 | } ); |
| 51 | BOOST_TEST_EQ(r, 1); |
| 52 | return boost::report_errors(); |
| 53 | } |
nothing calls this directly
no test coverage detected