diff --git a/Examples/test-suite/ruby/Makefile.in b/Examples/test-suite/ruby/Makefile.in index a127860b0..cb47b1c35 100644 --- a/Examples/test-suite/ruby/Makefile.in +++ b/Examples/test-suite/ruby/Makefile.in @@ -19,6 +19,7 @@ CPP_TEST_CASES = \ li_std_queue \ li_std_set \ li_std_stack \ + li_std_wstring \ primitive_types \ ruby_keywords \ ruby_minherit_shared_ptr \ diff --git a/Examples/test-suite/ruby/li_std_wstring_runme.rb b/Examples/test-suite/ruby/li_std_wstring_runme.rb new file mode 100644 index 000000000..eafb81f70 --- /dev/null +++ b/Examples/test-suite/ruby/li_std_wstring_runme.rb @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +require 'swig_assert' +require 'li_std_wstring' + +x = "h" + +swig_assert_equal("Li_std_wstring.test_value(x)", "x", binding) + + +x = "abc" + +swig_assert_equal("Li_std_wstring.test_value(x)", "x", binding) + +x = "hello" + +swig_assert_equal("Li_std_wstring.test_const_reference(x)", "x", binding) + +a = Li_std_wstring::A.new(x) + +swig_assert_equal("Li_std_wstring.test_value(a)", "x", binding) + +swig_assert_equal("Li_std_wstring.test_value(x)", "x", binding) diff --git a/Lib/ruby/std_basic_string.i b/Lib/ruby/std_basic_string.i index 1351177fc..a51333793 100644 --- a/Lib/ruby/std_basic_string.i +++ b/Lib/ruby/std_basic_string.i @@ -55,6 +55,10 @@ SWIGINTERNINLINE VALUE #if !defined(SWIG_STD_WSTRING) +%traits_swigtype(std::basic_string); +%fragment(SWIG_Traits_frag(std::basic_string)); + + %fragment(SWIG_AsPtr_frag(std::basic_string),"header", fragment="SWIG_AsWCharPtrAndSize") { SWIGINTERN int