Update of /cvsroot/luabind/luabind/luabind/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27248
Modified Files:
Tag: beta7-devel2
Jamfile
Added Files:
Tag: beta7-devel2
test_def_from_base.cpp test_resume_with_object.cpp
Log Message:
Two new tests.
--- NEW FILE: test_def_from_base.cpp ---
// Copyright (c) 2005 Daniel Wallin, Arvid Norberg
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
// OR OTHER DEALINGS IN THE SOFTWARE.
#include "test.hpp"
#include <luabind/luabind.hpp>
struct V
{
int f(int,int)
{
return 2;
}
};
struct W : V
{};
void test_main(lua_State* L)
{
using namespace luabind;
module(L)
[
class_<W>("W")
.def(constructor<>())
.def("f", &V::f)
];
DOSTRING(L,
"x = W()\n"
"assert(x:f(1,2) == 2)\n"
);
}
Index: Jamfile
===================================================================
RCS file: /cvsroot/luabind/luabind/luabind/test/Jamfile,v
retrieving revision 1.15.2.3
retrieving revision 1.15.2.4
diff -u -d -r1.15.2.3 -r1.15.2.4
--- Jamfile 30 Sep 2005 09:19:29 -0000 1.15.2.3
+++ Jamfile 19 Oct 2005 10:00:35 -0000 1.15.2.4
@@ -3,6 +3,8 @@
use-project /luabind : ../ ;
SOURCES =
+ test_resume_with_object.cpp
+ test_def_from_base.cpp
test_object.cpp
test_abstract_base.cpp
test_attributes.cpp
@@ -38,5 +40,7 @@
tests += [ run $(src) main-lib ] ;
}
-test-suite luabind-test : $(tests) [ compile test_typetraits.cpp ] ;
+test-suite luabind-test : $(tests)
+ [ compile test_typetraits.cpp ]
+ ;
--- NEW FILE: test_resume_with_object.cpp ---
// Copyright (c) 2005 Daniel Wallin, Arvid Norberg
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
// OR OTHER DEALINGS IN THE SOFTWARE.
#include "test.hpp"
#include <luabind/luabind.hpp>
#include <luabind/object.hpp>
//
// Demonstrates bug reported in:
// http://article.gmane.org/gmane.comp.lang.lua.bind.user/864/match=bug+resume+function
//
void f(char const*)
{}
void test_main(lua_State* L)
{
using namespace luabind;
module(L)
[
def("f", &f)
];
DOSTRING(L,
"function g()\n"
" f('xxx')\n"
" f(15)\n"
"end\n"
);
object g = globals(L)["g"];
resume_function<void>(g);
}
|