2
0
mirror of https://github.com/boostorg/leaf.git synced 2026-02-22 15:32:24 +00:00
This commit is contained in:
Emil Dotchevski
2026-02-18 15:25:29 -05:00
parent bd58aa238c
commit e8fe60e0cc
6 changed files with 115 additions and 8 deletions

View File

@@ -15,6 +15,7 @@
# define BOOST_WORKAROUND(a,b) 0
#endif
#include "_test_res.hpp"
#include "lightweight_test.hpp"
namespace leaf = boost::leaf;
@@ -63,6 +64,24 @@ leaf::result<void> f3( bool success )
return { };
}
#ifndef BOOST_LEAF_NO_CXX11_REF_QUALIFIERS
test_res<int, test_error> f_te( bool succeed )
{
if( succeed )
return 42;
else
return test_error(42);
}
test_res<int, test_error> g_check_te()
{
BOOST_LEAF_CHECK(f_te(false));
return 21;
}
#endif
int main()
{
BOOST_TEST_EQ(f2(true).value().x, 42);
@@ -70,5 +89,14 @@ int main()
BOOST_TEST(f3(true));
BOOST_TEST(!f3(false));
#ifndef BOOST_LEAF_NO_CXX11_REF_QUALIFIERS
{
auto r = g_check_te();
BOOST_TEST(!r);
BOOST_TEST(r.error().moved);
BOOST_TEST_EQ(r.error().value, 42);
}
#endif
return boost::report_errors();
}