summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2014-10-09 14:14:05 +0200
committerAndreas Baumann <mail@andreasbaumann.cc>2014-10-09 14:14:05 +0200
commit5c37d14e53c729c10d87849408058031d96d51f1 (patch)
treea7608265d23af6f4b60c701caacdea5babfb9d52 /tests
parent773bcc7ccd52dc72114b293bba9dbca1e9ae054a (diff)
downloadcrawler-5c37d14e53c729c10d87849408058031d96d51f1.tar.gz
crawler-5c37d14e53c729c10d87849408058031d96d51f1.tar.bz2
backported C++ string handling from tolua++ to tolua
added test for string parameter in tolua test adapted google normalizer example in crawl.conf
Diffstat (limited to 'tests')
-rwxr-xr-xtests/tolua/libtest1/TestMod.cpp5
-rwxr-xr-xtests/tolua/libtest1/TestMod.hpp2
-rw-r--r--tests/tolua/libtest1/TestMod.pkg5
-rw-r--r--tests/tolua/test1.lua1
4 files changed, 13 insertions, 0 deletions
diff --git a/tests/tolua/libtest1/TestMod.cpp b/tests/tolua/libtest1/TestMod.cpp
index b06644e..7e95d0f 100755
--- a/tests/tolua/libtest1/TestMod.cpp
+++ b/tests/tolua/libtest1/TestMod.cpp
@@ -12,6 +12,11 @@ void Derived::hello( )
cout << "hello" << endl;
}
+void Derived::hello( const std::string &message )
+{
+ cout << message << endl;
+}
+
static void initModule( void *user_data )
{
LuaVM *luaVm = (LuaVM *)user_data;
diff --git a/tests/tolua/libtest1/TestMod.hpp b/tests/tolua/libtest1/TestMod.hpp
index f4886cd..c9def19 100755
--- a/tests/tolua/libtest1/TestMod.hpp
+++ b/tests/tolua/libtest1/TestMod.hpp
@@ -13,6 +13,8 @@ class Derived : public Base
virtual ~Derived( ) { }
virtual void hello( );
+
+ virtual void hello( const std::string &msg );
};
DECLARE_MODULE( Base )
diff --git a/tests/tolua/libtest1/TestMod.pkg b/tests/tolua/libtest1/TestMod.pkg
index 4fed1d3..2bb4ebc 100644
--- a/tests/tolua/libtest1/TestMod.pkg
+++ b/tests/tolua/libtest1/TestMod.pkg
@@ -1,5 +1,9 @@
$#include "TestMod.hpp"
+$#include <string>
+
+$using namespace std;
+
class Derived : public Base
{
Derived( ) { }
@@ -7,4 +11,5 @@ class Derived : public Base
virtual ~Derived( ) { }
virtual void hello( );
+ virtual void hello( string msg );
};
diff --git a/tests/tolua/test1.lua b/tests/tolua/test1.lua
index 3310825..6d30937 100644
--- a/tests/tolua/test1.lua
+++ b/tests/tolua/test1.lua
@@ -1,3 +1,4 @@
local b = Derived:new( )
b:hello( )
+b:hello( "Show this string" )
b:delete( )