From 9168ff477ca3c674cd7eb18ea024547118bf2af4 Mon Sep 17 00:00:00 2001 From: Olly Betts Date: Fri, 21 Apr 2023 17:50:34 +1200 Subject: [lua] Test INPUT,INOUT,OUTPUT for std::string& --- Examples/test-suite/li_std_string.i | 2 +- Examples/test-suite/lua/li_std_string_runme.lua | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) 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 -#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 -- cgit v1.2.1