X-Git-Url: http://plrg.eecs.uci.edu/git/?p=folly.git;a=blobdiff_plain;f=folly%2Ftest%2FUtilityTest.cpp;h=5507b96f8855c193f08667b3a89b0c62bb2491cb;hp=9b77e170099aacf96ec1b887f33eec0731f6d4ba;hb=efcacd1c99bbea5411507e39ce74051a279be5e7;hpb=a1a70d9400becb9740c4a2ce582ab775499cd163 diff --git a/folly/test/UtilityTest.cpp b/folly/test/UtilityTest.cpp index 9b77e170..5507b96f 100644 --- a/folly/test/UtilityTest.cpp +++ b/folly/test/UtilityTest.cpp @@ -14,8 +14,9 @@ * limitations under the License. */ -#include +#include +#include #include namespace { @@ -88,3 +89,24 @@ TEST(FollyIntegerSequence, core) { static_assert(seq3.size() == 3, ""); EXPECT_EQ(3, seq3.size()); } + +TEST_F(UtilityTest, MoveOnly) { + class FooBar : folly::MoveOnly { + int a; + }; + + static_assert( + !std::is_copy_constructible::value, + "Should not be copy constructible"); + + // Test that move actually works. + FooBar foobar; + FooBar foobar2(std::move(foobar)); + (void)foobar2; + + // Test that inheriting from MoveOnly doesn't prevent the move + // constructor from being noexcept. + static_assert( + std::is_nothrow_move_constructible::value, + "Should have noexcept move constructor"); +}