Skip to content

Commit

Permalink
Add test for issue #59 (thanks @polasek)
Browse files Browse the repository at this point in the history
  • Loading branch information
martinmoene committed Jun 22, 2023
1 parent 49af05a commit 87db44d
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test/expected.t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1877,6 +1877,33 @@ int compare_not_equal_with_expected_void()

} // namespace issue_51

namespace issue_59 {

struct NonMovableNonCopyable
{
NonMovableNonCopyable() = default;

NonMovableNonCopyable( NonMovableNonCopyable const & ) = delete;
NonMovableNonCopyable( NonMovableNonCopyable && ) = delete;
NonMovableNonCopyable& operator=( NonMovableNonCopyable const & ) = delete;
NonMovableNonCopyable& operator=( NonMovableNonCopyable && ) = delete;
};
} // namespace issue_59

CASE( "issue-58" )
{
using namespace issue_59;

static_assert( !std::is_copy_constructible<NonMovableNonCopyable>::value, "is not copy constructible" );
static_assert( !std::is_move_constructible<NonMovableNonCopyable>::value, "is not move constructible" );

nonstd::expected<NonMovableNonCopyable, NonMovableNonCopyable> expected;
nonstd::expected<NonMovableNonCopyable, NonMovableNonCopyable> unexpected( nonstd::unexpect_t{} );

EXPECT( expected.has_value() );
EXPECT( !unexpected.has_value() );
}

// -----------------------------------------------------------------------
// using as optional

Expand Down

0 comments on commit 87db44d

Please sign in to comment.