[luabind-cvs] luabind/luabind/test test_attributes.cpp,1.31.2.4,1.31.2.5
Brought to you by:
arvidn,
daniel_wallin
From: Arvid N. <ar...@us...> - 2005-10-26 16:10:47
|
Update of /cvsroot/luabind/luabind/luabind/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24965/test Modified Files: Tag: beta7-devel2 test_attributes.cpp Log Message: properties now make the returned reference keep the object alive using the dependency policy Index: test_attributes.cpp =================================================================== RCS file: /cvsroot/luabind/luabind/luabind/test/test_attributes.cpp,v retrieving revision 1.31.2.4 retrieving revision 1.31.2.5 diff -u -d -r1.31.2.4 -r1.31.2.5 --- test_attributes.cpp 24 Oct 2005 22:24:54 -0000 1.31.2.4 +++ test_attributes.cpp 26 Oct 2005 16:10:27 -0000 1.31.2.5 @@ -43,6 +43,7 @@ struct property_test : counted_type<property_test> { property_test(): o(6), c_ref(&c) {} + ~property_test() { c.a = 0; } std::string str_; int a_; @@ -138,6 +139,16 @@ DOSTRING(L, "test.c.a = 1\n" "assert(test.c.a == 1)\n" "assert(test.c_ref.a == 1)"); + + DOSTRING(L, "t1 = property()\n" + "c = t1.c\n" + "c2 = t1.c_ref\n" + "c.a = 1\n" + "t1 = nil\n" + "collectgarbage()\n" + "collectgarbage()\n" + "assert(c.a == 1)\n" + "assert(c2.a == 1)"); DOSTRING(L, "a = B()\n"); |