summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlly Betts <olly@survex.com>2023-04-21 17:50:34 +1200
committerOlly Betts <olly@survex.com>2023-04-21 17:50:34 +1200
commit9168ff477ca3c674cd7eb18ea024547118bf2af4 (patch)
tree082a56b0355cfaca8a258a7828ba0681c8d0c6d2
parent6cd19ba92612dfca3ac0a66740050bf539263543 (diff)
downloadswig-9168ff477ca3c674cd7eb18ea024547118bf2af4.tar.gz
[lua] Test INPUT,INOUT,OUTPUT for std::string&
-rw-r--r--Examples/test-suite/li_std_string.i2
-rw-r--r--Examples/test-suite/lua/li_std_string_runme.lua6
2 files changed, 7 insertions, 1 deletions
diff --git a/Examples/test-suite/li_std_string.i b/Examples/test-suite/li_std_string.i
index 209cf883f..6f8fec130 100644
--- a/Examples/test-suite/li_std_string.i
+++ b/Examples/test-suite/li_std_string.i
@@ -1,7 +1,7 @@
%module li_std_string
%include <std_string.i>
-#if defined(SWIGPHP) || defined(SWIGUTL)
+#if defined(SWIGLUA) || defined(SWIGPHP) || defined(SWIGUTL)
%apply std::string& INPUT { std::string &input }
%apply std::string& INOUT { std::string &inout }
%apply std::string& OUTPUT { std::string &output }
diff --git a/Examples/test-suite/lua/li_std_string_runme.lua b/Examples/test-suite/lua/li_std_string_runme.lua
index 40de81e44..4e6dbe7f1 100644
--- a/Examples/test-suite/lua/li_std_string_runme.lua
+++ b/Examples/test-suite/lua/li_std_string_runme.lua
@@ -44,6 +44,12 @@ test_reference(robj)
test_reference(obj) -- object ptr is ok
test_reference(cobj) -- obj const ptr is also ok
+-- Test INPUT, INOUT and OUTPUT string& typemaps:
+assert(test_reference_input("hello")=="hello")
+s=test_reference_inout("hello")
+assert(s=="hellohello")
+assert(test_reference_output()=="output")
+
-- throwing string
ok,ex=pcall(test_throw)
assert(ok==false and type(ex)=="string") -- failed & threw string