mirror of
https://github.com/boostorg/leaf.git
synced 2026-02-22 15:32:24 +00:00
Issue 89
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user