diff options
author | Olly Betts <olly@survex.com> | 2023-04-21 17:50:34 +1200 |
---|---|---|
committer | Olly Betts <olly@survex.com> | 2023-04-21 17:50:34 +1200 |
commit | 9168ff477ca3c674cd7eb18ea024547118bf2af4 (patch) | |
tree | 082a56b0355cfaca8a258a7828ba0681c8d0c6d2 | |
parent | 6cd19ba92612dfca3ac0a66740050bf539263543 (diff) | |
download | swig-9168ff477ca3c674cd7eb18ea024547118bf2af4.tar.gz |
[lua] Test INPUT,INOUT,OUTPUT for std::string&
-rw-r--r-- | Examples/test-suite/li_std_string.i | 2 | ||||
-rw-r--r-- | Examples/test-suite/lua/li_std_string_runme.lua | 6 |
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 |