MCPcopy Create free account
hub / github.com/boostorg/leaf / main

Function main

test/multiple_errors_test.cpp:33–112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31}
32
33int main()
34{
35 {
36 int r = leaf::try_handle_all(
37 []() -> leaf::result<int>
38 {
39 leaf::result<void> r1 = f12();
40 (void) r1;
41 leaf::result<void> r2 = f23();
42 return r2.error();
43 },
44 []( info<1> )
45 {
46 return 1;
47 },
48 []( info<2> const & x, info<3> const & y )
49 {
50 BOOST_TEST_EQ(x.value, 2);
51 BOOST_TEST_EQ(y.value, 3);
52 return 2;
53 },
54 []
55 {
56 return 3;
57 } );
58 BOOST_TEST_EQ(r, 2);
59 }
60
61#ifndef BOOST_LEAF_NO_EXCEPTIONS
62 {
63 int r = leaf::try_catch(
64 []() -> int
65 {
66 try
67 {
68 leaf::throw_exception(info<4>{4});
69 }
70 catch(...)
71 {
72 }
73 throw std::exception{};
74 },
75 []( std::exception const &, info<4> )
76 {
77 return 1;
78 },
79 []( std::exception const & )
80 {
81 return 2;
82 } );
83 BOOST_TEST_EQ(r, 2);
84 }
85 {
86 int r = leaf::try_catch(
87 []() -> int
88 {
89 try
90 {

Callers

nothing calls this directly

Calls 8

try_handle_allFunction · 0.85
f12Function · 0.85
f23Function · 0.85
try_catchFunction · 0.85
on_errorFunction · 0.85
report_errorsFunction · 0.85
throw_exceptionFunction · 0.70
exceptionClass · 0.50

Tested by

no test coverage detected