Skip to content

Commit

Permalink
Add additional checks to automatic_smart_ptr test.
Browse files Browse the repository at this point in the history
This tests the issue reported in #4 (and seems to invalidate the issue by
succeeding).
  • Loading branch information
Oberon00 committed Aug 3, 2013
1 parent a3f46b2 commit f9499ec
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion test/test_automatic_smart_ptr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,19 @@ void test_main(lua_State* L)
"assert(x3.value == 3)\n"
);

DOSTRING(L, "function get2() return x2 end");
boost::shared_ptr<X> spx = call_function<boost::shared_ptr<X>>(L, "get2");
TEST_CHECK(spx.use_count() == 2);

DOSTRING(L,
"x1 = nil\n"
"x2 = nil\n"
"x3 = nil\n"
"collectgarbage()\n"
);

assert(X::alive == 0);
TEST_CHECK(spx.use_count() == 1);
TEST_CHECK(X::alive == 1);
spx.reset();
TEST_CHECK(X::alive == 0);
}

0 comments on commit f9499ec

Please sign in to comment.