]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/leaf/test/preload_nested_new_error_result_test.cpp
1 // Copyright (c) 2018-2020 Emil Dotchevski and Reverge Studios, Inc.
3 // Distributed under the Boost Software License, Version 1.0. (See accompanying
4 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 #include <boost/leaf/on_error.hpp>
7 #include <boost/leaf/handle_errors.hpp>
8 #include <boost/leaf/result.hpp>
9 #include "lightweight_test.hpp"
11 namespace leaf
= boost::leaf
;
21 auto load
= leaf::on_error( info
<0>{-1} );
22 return leaf::new_error( info
<1>{-1} );
27 auto load
= leaf::on_error(info
<0>{}, info
<1>{1}, info
<2>{2} );
29 return leaf::new_error();
34 return f1().load( info
<3>{3} );
39 int r
= leaf::try_handle_all(
40 []() -> leaf::result
<int>
44 []( info
<0> i0
, info
<1> i1
, info
<2> i2
, info
<3> i3
)
46 BOOST_TEST_EQ(i0
.value
, 0);
47 BOOST_TEST_EQ(i1
.value
, 1);
48 BOOST_TEST_EQ(i2
.value
, 2);
49 BOOST_TEST_EQ(i3
.value
, 3);
58 return boost::report_errors();