diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/modules/test4.MUST | 2 | ||||
-rwxr-xr-x | tests/modules/testmod4/TestMod4.cpp | 10 | ||||
-rwxr-xr-x | tests/tolua/libtest1/TestMod.cpp | 5 | ||||
-rwxr-xr-x | tests/tolua/test1.cpp | 7 |
4 files changed, 14 insertions, 10 deletions
diff --git a/tests/modules/test4.MUST b/tests/modules/test4.MUST index 1d14a0c..9ef1168 100644 --- a/tests/modules/test4.MUST +++ b/tests/modules/test4.MUST @@ -2,5 +2,5 @@ Created common object test4: Module 4 initModule called with user data: 47 hello there test4: hello from main test4: hello world from module -test4: Module 4 destroyModule called +test4: Module 4 destroyModule called with user data: 47 hello there Destroyed common object diff --git a/tests/modules/testmod4/TestMod4.cpp b/tests/modules/testmod4/TestMod4.cpp index de8b1b6..f2d0ecd 100755 --- a/tests/modules/testmod4/TestMod4.cpp +++ b/tests/modules/testmod4/TestMod4.cpp @@ -34,9 +34,15 @@ static void initModule( void *user_data ) Common::instance( ).print( ss.str( ) ); } -static void destroyModule( ) +static void destroyModule( void *user_data ) { - Common::instance( ).print( "Module 4 destroyModule called" ); + UserData *data = (UserData *)user_data; + ostringstream ss; + + ss << "Module 4 destroyModule called with user data: " + << data->version << " " << data->text; + + Common::instance( ).print( ss.str( ) ); } REGISTER_MODULE( "testmod4", &initModule, &destroyModule, Base, Derived ) diff --git a/tests/tolua/libtest1/TestMod.cpp b/tests/tolua/libtest1/TestMod.cpp index 912d652..b06644e 100755 --- a/tests/tolua/libtest1/TestMod.cpp +++ b/tests/tolua/libtest1/TestMod.cpp @@ -19,8 +19,11 @@ static void initModule( void *user_data ) tolua_TestMod_open( luaVm->handle( ) ); } -static void destroyModule( ) +static void destroyModule( void *user_data ) { + LuaVM *luaVm = (LuaVM *)user_data; + + luaVm->fullGarbageCollect( ); } REGISTER_MODULE( "testmod", &initModule, &destroyModule, Base, Derived ) diff --git a/tests/tolua/test1.cpp b/tests/tolua/test1.cpp index 902b278..271544e 100755 --- a/tests/tolua/test1.cpp +++ b/tests/tolua/test1.cpp @@ -23,13 +23,8 @@ int main( int /* argc */, char *argv[] ) luaVm.loadSource( argv[1] ); luaVm.executeMain( ); - //luaVm.dumpState( ); - - //Base *obj = loader.create( "testmod" ); - //obj->hello( ); - //loader.destroy( obj ); - return 0; + } catch( exception &e ) { LOG( logFATAL ) << "ERROR: " << e.what( ); return 1; |