Update of /cvsroot/luabind/luabind/luabind/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7247/luabind/test
Modified Files:
makefile test_held_type.cpp test_lua_classes.cpp
test_object.cpp
Log Message:
merged back rc 0.7 changes into head
Index: makefile
===================================================================
RCS file: /cvsroot/luabind/luabind/luabind/test/makefile,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- makefile 28 Nov 2005 20:55:34 -0000 1.21
+++ makefile 26 Mar 2006 15:47:30 -0000 1.22
@@ -26,15 +26,13 @@
test_iterator.cpp \
-CPPFLAGS = -Wno-long-double
-
all: $(SOURCES:.cpp=.exe)
%.exe:%.o main.o
$(CXX) $? -o $@ -g -L$(LUA_PATH)/lib -L../lib -lluabind -llualib -llua
%.o:%.cpp
- $(CXX) -Wall -ftemplate-depth-100 -g $(CPPFLAGS) $(CONFIG) -I$(LUA_PATH)/include -I. -I- -I../ -I$(BOOST_ROOT) -c $? -o $@
+ $(CXX) -Wall -ftemplate-depth-100 -g $(CONFIG) -I$(LUA_PATH)/include -I. -I- -I../ -I$(BOOST_ROOT) -c $? -o $@
#just to force the tests to be run
test: $(SOURCES:.cpp=.dummy)
Index: test_held_type.cpp
===================================================================
RCS file: /cvsroot/luabind/luabind/luabind/test/test_held_type.cpp,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- test_held_type.cpp 28 Nov 2005 20:55:34 -0000 1.30
+++ test_held_type.cpp 26 Mar 2006 15:47:30 -0000 1.31
@@ -27,11 +27,13 @@
namespace luabind {
+#ifdef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
template<class T>
- T* get_pointer(boost::shared_ptr<T>& p) { return p.get(); }
+ T* get_pointer(boost::shared_ptr<T> const& p) { return p.get(); }
+#endif
template<class A>
- boost::shared_ptr<const A>* get_const_holder(boost::shared_ptr<A>*)
+ boost::shared_ptr<const A>* get_const_holder(boost::shared_ptr<A> const*)
{
return 0;
}
Index: test_object.cpp
===================================================================
RCS file: /cvsroot/luabind/luabind/luabind/test/test_object.cpp,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- test_object.cpp 28 Nov 2005 20:55:34 -0000 1.28
+++ test_object.cpp 26 Mar 2006 15:47:30 -0000 1.29
@@ -26,6 +26,9 @@
#include <luabind/adopt_policy.hpp>
#include <luabind/detail/debug.hpp>
#include <luabind/error.hpp>
+#include <luabind/operator.hpp>
+
+#include <boost/lexical_cast.hpp>
#include <utility>
@@ -87,6 +90,9 @@
{
luabind::object obj;
luabind::object obj2;
+
+ bool operator==(test_param const& rhs) const
+ { return obj == rhs.obj && obj2 == rhs.obj2; }
};
COUNTER_GUARD(test_param);
@@ -127,11 +133,19 @@
.def(constructor<>())
.def_readwrite("obj", &test_param::obj)
.def_readonly("obj2", &test_param::obj2)
+ .def(const_self == const_self)
];
object uninitialized;
TEST_CHECK(!uninitialized);
TEST_CHECK(!uninitialized.is_valid());
+
+ test_param temp_object;
+ globals(L)["temp"] = temp_object;
+ TEST_CHECK(object_cast<test_param>(globals(L)["temp"]) == temp_object);
+ globals(L)["temp"] = &temp_object;
+ TEST_CHECK(object_cast<test_param const*>(globals(L)["temp"]) == &temp_object);
+ TEST_CHECK(globals(L)["temp"] == temp_object);
DOSTRING(L,
"t = 2\n"
@@ -153,6 +167,9 @@
int a = type(test_param_policies);
TEST_CHECK(a == LUA_TFUNCTION);
+ luabind::object obj;
+ obj = luabind::object();
+
// call the function and tell lua to adopt the pointer passed as first argument
test_param_policies(5, new test_param())[adopt(_2)];
@@ -179,6 +196,11 @@
object temp_val = g["temp_val"];
TEST_CHECK(ret_val == temp_val);
+ g["temp"] = "test string";
+ TEST_CHECK(boost::lexical_cast<std::string>(g["temp"]) == "test string");
+ g["temp"] = 6;
+ TEST_CHECK(boost::lexical_cast<std::string>(g["temp"]) == "6");
+
TEST_CHECK(object_cast<std::string>(g["glob"]) == "teststring");
TEST_CHECK(object_cast<std::string>(gettable(g, "glob")) == "teststring");
TEST_CHECK(object_cast<std::string>(rawget(g, "glob")) == "teststring");
Index: test_lua_classes.cpp
===================================================================
RCS file: /cvsroot/luabind/luabind/luabind/test/test_lua_classes.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- test_lua_classes.cpp 28 Nov 2005 20:55:34 -0000 1.27
+++ test_lua_classes.cpp 26 Mar 2006 15:47:30 -0000 1.28
@@ -29,8 +29,10 @@
namespace luabind {
+#ifdef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
template<class T>
- T* get_pointer(boost::shared_ptr<T>& p) { return p.get(); }
+ T* get_pointer(boost::shared_ptr<T> const& p) { return p.get(); }
+#endif
template<class A>
boost::shared_ptr<const A>* get_const_holder(boost::shared_ptr<A>*)
|