void fiber_base::rethrow() const { BOOST_ASSERT( has_exception() ); rethrow_exception( except_); }
TEST( expect, copyable_expect_with_value ) { auto expect = q::fulfill< Copyable >( Copyable( ) ); EXPECT_FALSE( expect.has_exception( ) ); EXPECT_EQ( expect.exception( ), std::exception_ptr( ) ); EXPECT_NO_THROW( expect.get( ) ); EXPECT_NO_THROW( expect.consume( ) ); }
TEST( expect, void_expect_with_value ) { auto expect = q::fulfill< void >( ); EXPECT_FALSE( expect.has_exception( ) ); EXPECT_EQ( expect.exception( ), std::exception_ptr( ) ); EXPECT_NO_THROW( expect.get( ) ); EXPECT_NO_THROW( expect.consume( ) ); }
TEST( expect, movable_expect_with_exception ) { auto expect = q::refuse< Movable >( make_exception( ) ); EXPECT_TRUE( expect.has_exception( ) ); EXPECT_NO_THROW( expect.exception( ) ); EXPECT_THROW( expect.get( ), test_exception ); EXPECT_THROW( expect.consume( ), test_exception ); }
TEST( expect, void_expect_With_exception ) { auto expect = q::refuse< void >( make_exception( ) ); EXPECT_TRUE( expect.has_exception( ) ); EXPECT_NO_THROW( expect.exception( ) ); EXPECT_THROW( expect.get( ), test_exception ); EXPECT_THROW( expect.consume( ), test_exception ); }
TEST( expect, exception_expect_with_exception ) { auto expect = q::refuse< std::exception_ptr >( make_exception( ) ); EXPECT_TRUE( expect.has_exception( ) ); EXPECT_NE( expect.exception( ), std::exception_ptr( ) ); EXPECT_THROW( expect.get( ), test_exception ); EXPECT_THROW( expect.consume( ), test_exception ); }
TEST( expect, exception_expect_with_null_value ) { auto expect = q::fulfill< std::exception_ptr >( make_null_exception( ) ); EXPECT_FALSE( expect.has_exception( ) ); EXPECT_EQ( expect.exception( ), std::exception_ptr( ) ); EXPECT_NO_THROW( expect.get( ) ); EXPECT_NO_THROW( expect.consume( ) ); }
TEST( expect, any_expect_with_value ) { auto expect = q::fulfill< std::string >( std::string( ) ); EXPECT_FALSE( expect.has_exception( ) ); EXPECT_EQ( expect.exception( ), std::exception_ptr( ) ); EXPECT_NO_THROW( expect.get( ) ); EXPECT_NO_THROW( expect.consume( ) ); }
bool has_value() const { return !has_exception(); }