[luabind-cvs] luabind/luabind/test test_attributes.cpp,1.31.2.3,1.31.2.4
Brought to you by:
arvidn,
daniel_wallin
From: Arvid N. <ar...@us...> - 2005-10-24 22:25:02
|
Update of /cvsroot/luabind/luabind/luabind/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1243/test Modified Files: Tag: beta7-devel2 test_attributes.cpp Log Message: updated the documentation and added another test for the new property code Index: test_attributes.cpp =================================================================== RCS file: /cvsroot/luabind/luabind/luabind/test/test_attributes.cpp,v retrieving revision 1.31.2.3 retrieving revision 1.31.2.4 diff -u -d -r1.31.2.3 -r1.31.2.4 --- test_attributes.cpp 24 Oct 2005 09:44:00 -0000 1.31.2.3 +++ test_attributes.cpp 24 Oct 2005 22:24:54 -0000 1.31.2.4 @@ -42,13 +42,14 @@ struct property_test : counted_type<property_test> { - property_test(): o(6) {} + property_test(): o(6), c_ref(&c) {} std::string str_; int a_; float o; signed char b; C c; + C* c_ref; void set(int a) { a_ = a; } int get() const { return a_; } @@ -84,9 +85,10 @@ .property("str", &property_test::get_str, &property_test::set_str) .property("A", &property_test::getA, &property_test::setA) .def_readonly("o", &property_test::o) - .property("free", &free_getter, &free_setter) + .property("free", &free_getter, &free_setter) .def_readwrite("b", &property_test::b) - .def_readwrite("c", &property_test::c), + .def_readwrite("c", &property_test::c) + .def_readwrite("c_ref", &property_test::c_ref), class_<A>("A") .def(constructor<>()) @@ -134,7 +136,8 @@ "assert(test.b == 3)\n"); DOSTRING(L, "test.c.a = 1\n" - "assert(test.c.a == 1)\n"); + "assert(test.c.a == 1)\n" + "assert(test.c_ref.a == 1)"); DOSTRING(L, "a = B()\n"); |