[ruby] add a few tests for std::wstring

This commit is contained in:
Takashi Tamura 2017-02-18 17:54:03 +09:00
commit bfe7204576
3 changed files with 27 additions and 0 deletions

View file

@ -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 \

View file

@ -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)

View file

@ -55,6 +55,10 @@ SWIGINTERNINLINE VALUE
#if !defined(SWIG_STD_WSTRING)
%traits_swigtype(std::basic_string<wchar_t>);
%fragment(SWIG_Traits_frag(std::basic_string<wchar_t>));
%fragment(SWIG_AsPtr_frag(std::basic_string<wchar_t>),"header",
fragment="SWIG_AsWCharPtrAndSize") {
SWIGINTERN int