Skip to content

Commit

Permalink
Add check for OnlyMove on std::set
Browse files Browse the repository at this point in the history
  • Loading branch information
dubzzz committed Oct 29, 2015
1 parent c05641f commit 27ac6d5
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/test-py2cpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -916,6 +916,21 @@ TEST(CppBuilder_move, InVector)
EXPECT_FALSE(uncaught_exception());
}

TEST(CppBuilder_move, InSet)
{
unique_ptr_ctn pyo { PyRun_String("set([(1,),(3,),(2,)])", Py_eval_input, get_py_dict(), NULL) };
OnlyMove expected1 { 1 };
OnlyMove expected2 { 2 };
OnlyMove expected3 { 3 };
ASSERT_NE(nullptr, pyo.get());
auto ret = CppBuilder<std::set<OnlyMove::FromPy>>()(pyo.get());
auto it = ret.begin();
EXPECT_TRUE(expected1 == it++);
EXPECT_TRUE(expected2 == it++);
EXPECT_TRUE(expected3 == it++);
EXPECT_FALSE(uncaught_exception());
}

TEST(CppBuilder_move, InOtherObject)
{
unique_ptr_ctn pyo { PyRun_String("{'nmove': (2,)}", Py_eval_input, get_py_dict(), NULL) };
Expand Down

0 comments on commit 27ac6d5

Please sign in to comment.