[ruby] add std::wstring tests for string including a null terminator.

This commit is contained in:
Takashi Tamura 2017-02-20 17:49:17 +09:00
commit 89695255e6
2 changed files with 6 additions and 1 deletions

View file

@ -35,3 +35,8 @@ begin
rescue RuntimeError => e
swig_assert_equal("e.message", "'x'", binding)
end
x = "abc\0def"
swig_assert_equal("Li_std_wstring.test_value(x)", "x", binding)
swig_assert_equal("Li_std_wstring.test_ccvalue(x)", '"abc"', binding)
swig_assert_equal("Li_std_wstring.test_wchar_overload(x)", '"abc"', binding)

View file

@ -26,7 +26,7 @@ extern "C" {
/**
* If Encoding.default_internal is nil, this encoding will be used
* when coverting from std::wstring to String object in Ruby.
* when converting from std::wstring to String object in Ruby.
*/
#ifndef SWIG_RUBY_INTERNAL_ENCODING
#define SWIG_RUBY_INTERNAL_ENCODING "UTF-8"