From a9a7b03ba6557a6f9c8c8b284d907d6a7017e989 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Mon, 22 Jul 2019 19:05:21 +0100 Subject: Split testcases li_std_wstring.i and li_std_wstring_inherit.i Not many languages have support for std_wstring.i, so disable testing for these languages until added. --- Examples/test-suite/common.mk | 1 + Examples/test-suite/csharp/li_std_wstring_runme.cs | 128 ++++++++++----------- Examples/test-suite/li_std_wstring.i | 51 ++------ Examples/test-suite/li_std_wstring_inherit.i | 74 ------------ Examples/test-suite/octave/li_std_wstring_runme.m | 95 --------------- .../python/li_std_wstring_inherit_runme.py | 61 ---------- Examples/test-suite/python/li_std_wstring_runme.py | 113 +++++++----------- .../ruby/li_std_wstring_inherit_runme.rb | 30 ----- Examples/test-suite/ruby/li_std_wstring_runme.rb | 42 ++++--- 9 files changed, 141 insertions(+), 454 deletions(-) delete mode 100644 Examples/test-suite/octave/li_std_wstring_runme.m diff --git a/Examples/test-suite/common.mk b/Examples/test-suite/common.mk index 742536201..7aa0e91d1 100644 --- a/Examples/test-suite/common.mk +++ b/Examples/test-suite/common.mk @@ -655,6 +655,7 @@ CPP_STD_TEST_CASES += \ li_std_vector_enum \ li_std_vector_member_var\ li_std_vector_ptr \ + li_std_wstring \ smart_pointer_inherit \ template_typedef_fnc \ template_type_namespace \ diff --git a/Examples/test-suite/csharp/li_std_wstring_runme.cs b/Examples/test-suite/csharp/li_std_wstring_runme.cs index fe663a3e0..501ab8496 100644 --- a/Examples/test-suite/csharp/li_std_wstring_runme.cs +++ b/Examples/test-suite/csharp/li_std_wstring_runme.cs @@ -3,74 +3,74 @@ using li_std_wstringNamespace; public class runme { - static void Main() + static private void check_equal(char a, char b) { - char y='h'; - - if (li_std_wstring.test_wcvalue(y) != y) - throw new Exception("bad string mapping:" + li_std_wstring.test_wcvalue(y)); - - if (li_std_wstring.test_wcvalue_w() != 'W') - throw new Exception("bad string mapping:" + li_std_wstring.test_wcvalue_w()); - - string x="hello"; - - if (li_std_wstring.test_ccvalue(x) != x) - throw new Exception("bad string mapping"); - - if (li_std_wstring.test_cvalue(x) != x) - throw new Exception("bad string mapping"); - - - if (li_std_wstring.test_value(x) != x) - throw new Exception("bad string mapping: " + x + li_std_wstring.test_value(x)); - - if (li_std_wstring.test_const_reference(x) != x) - throw new Exception("bad string mapping"); - - - string s = "he"; - s = s + "llo"; - - if (s != x) - throw new Exception("bad string mapping: " + s + x); - - if (li_std_wstring.test_value(s) != x) - throw new Exception("bad string mapping"); - - if (li_std_wstring.test_const_reference(s) != x) - throw new Exception("bad string mapping"); - - string a = s; - - if (li_std_wstring.test_value(a) != x) - throw new Exception("bad string mapping"); - - if (li_std_wstring.test_const_reference(a) != x) - throw new Exception("bad string mapping"); - - string b = " world"; - - if (a + b != "hello world") - throw new Exception("bad string mapping"); - - if (a + " world" != "hello world") - throw new Exception("bad string mapping"); - - if ("hello" + b != "hello world") - throw new Exception("bad string mapping"); - - s = "hello world"; + if (a != b) + throw new Exception("failed " + a + " " + b); + } - B myB = new B("hi"); + static private void check_equal(string a, string b) + { + if (a != b) + throw new Exception("failed " + a + " " + b); + } - myB.name = "hello"; - if (myB.name != "hello") - throw new Exception("bad string mapping"); + static void Main() + { + char h = 'h'; + check_equal(li_std_wstring.test_wcvalue(h), h); + + string x = "abc"; + check_equal(li_std_wstring.test_ccvalue(x), x); + check_equal(li_std_wstring.test_cvalue(x), x); + + check_equal(li_std_wstring.test_wchar_overload(x), x); + check_equal(li_std_wstring.test_wchar_overload(), null); + + li_std_wstring.test_pointer(null); + li_std_wstring.test_const_pointer(null); + + try { + li_std_wstring.test_value(null); + throw new Exception("NULL check failed"); + } catch (ArgumentNullException) { + } + + try { + li_std_wstring.test_reference(null); + throw new Exception("NULL check failed"); + } catch (ArgumentNullException e) { + if (!e.Message.Contains("type is null")) + throw new Exception("Missing text " + e); + } + try { + li_std_wstring.test_const_reference(null); + throw new Exception("NULL check failed"); + } catch (ArgumentNullException e) { + if (!e.Message.Contains("null wstring")) + throw new Exception("Missing text " + e); + } + + x = "hello"; + check_equal(li_std_wstring.test_const_reference(x), x); + + /* TODO + string s = "abc"; + if (!li_std_wstring.test_equal_abc(s)) + throw new Exception("Not equal " + s); + + try { + li_std_wstring.test_throw(); + } catch (Exception e) { + check_equal(e.Message, "throwing test_throw"); + } + + x = "abc\0def"; + check_equal(li_std_wstring.test_value(x), x); + check_equal(li_std_wstring.test_ccvalue(x), "abc"); + check_equal(li_std_wstring.test_wchar_overload(x), "abc"); + */ - myB.a = "hello"; - if (myB.a != "hello") - throw new Exception("bad string mapping"); } } diff --git a/Examples/test-suite/li_std_wstring.i b/Examples/test-suite/li_std_wstring.i index b2b7305da..55d45383e 100644 --- a/Examples/test-suite/li_std_wstring.i +++ b/Examples/test-suite/li_std_wstring.i @@ -1,7 +1,9 @@ %module li_std_wstring -%include -%include +// The languages below are yet to provide std_wstring.i +#if !(defined(SWIGD) || defined(SWIGGO) || defined(SWIGGUILE) || defined(SWIGJAVASCRIPT) || defined(SWIGLUA) || defined(SWIGMZSCHEME) || defined(SWIGOCAML) || defined(SWIGOCTAVE) || defined(SWIGPERL) || defined(SWIGPHP) || defined(SWIGR) || defined(SWIGSCILAB)) + +%include // throw is invalid in C++17 and later, only SWIG to use it #define TESTCASE_THROW1(T1) throw(T1) @@ -10,26 +12,7 @@ %} %inline %{ - -struct A : std::wstring -{ - A(const std::wstring& s) : std::wstring(s) - { - } -}; - -struct B -{ - B(const std::wstring& s) : cname(0), name(s), a(s) - { - } - - char *cname; - std::wstring name; - A a; - -}; - +#include wchar_t test_wcvalue(wchar_t x) { return x; @@ -63,33 +46,18 @@ const std::wstring& test_const_reference(const std::wstring &x) { void test_pointer(std::wstring *x) { } -std::wstring *test_pointer_out() { - static std::wstring x = L"x"; - return &x; -} - void test_const_pointer(const std::wstring *x) { } -const std::wstring *test_const_pointer_out() { - static std::wstring x = L"x"; - return &x; -} - void test_reference(std::wstring &x) { } -std::wstring& test_reference_out() { - static std::wstring x = L"x"; - return x; -} - bool test_equal_abc(const std::wstring &s) { return L"abc" == s; } void test_throw() TESTCASE_THROW1(std::wstring){ - static std::wstring x = L"x"; + static std::wstring x = L"throwing test_throw"; throw x; } @@ -102,12 +70,7 @@ size_t size_wstring(const std::wstring& s) { return s.size(); } -#ifdef SWIGPYTHON_BUILTIN -bool is_python_builtin() { return true; } -#else -bool is_python_builtin() { return false; } -#endif - %} +#endif diff --git a/Examples/test-suite/li_std_wstring_inherit.i b/Examples/test-suite/li_std_wstring_inherit.i index 547c41a87..54c6bd8c4 100644 --- a/Examples/test-suite/li_std_wstring_inherit.i +++ b/Examples/test-suite/li_std_wstring_inherit.i @@ -3,12 +3,6 @@ %include -// throw is invalid in C++17 and later, only SWIG to use it -#define TESTCASE_THROW1(T1) throw(T1) -%{ -#define TESTCASE_THROW1(T1) -%} - %inline %{ struct A : std::wstring @@ -30,78 +24,10 @@ struct B }; - -wchar_t test_wcvalue(wchar_t x) { - return x; -} - -const wchar_t* test_ccvalue(const wchar_t* x) { - return x; -} - -wchar_t* test_cvalue(wchar_t* x) { - return x; -} - - -wchar_t* test_wchar_overload() { - return 0; -} - -wchar_t* test_wchar_overload(wchar_t *x) { - return x; -} - std::wstring test_value(std::wstring x) { return x; } -const std::wstring& test_const_reference(const std::wstring &x) { - return x; -} - -void test_pointer(std::wstring *x) { -} - -std::wstring *test_pointer_out() { - static std::wstring x = L"x"; - return &x; -} - -void test_const_pointer(const std::wstring *x) { -} - -const std::wstring *test_const_pointer_out() { - static std::wstring x = L"x"; - return &x; -} - -void test_reference(std::wstring &x) { -} - -std::wstring& test_reference_out() { - static std::wstring x = L"x"; - return x; -} - -bool test_equal_abc(const std::wstring &s) { - return L"abc" == s; -} - -void test_throw() TESTCASE_THROW1(std::wstring){ - static std::wstring x = L"x"; - - throw x; -} - -const char * non_utf8_c_str() { - return "h\xe9llo"; -} - -size_t size_wstring_size(const std::wstring& s) { - return s.size(); -} - #ifdef SWIGPYTHON_BUILTIN bool is_python_builtin() { return true; } #else diff --git a/Examples/test-suite/octave/li_std_wstring_runme.m b/Examples/test-suite/octave/li_std_wstring_runme.m deleted file mode 100644 index cbccc0c12..000000000 --- a/Examples/test-suite/octave/li_std_wstring_runme.m +++ /dev/null @@ -1,95 +0,0 @@ -# do not dump Octave core -if exist("crash_dumps_octave_core", "builtin") - crash_dumps_octave_core(0); -endif - -li_std_wstring - -x="h"; - -if (li_std_wstring.test_wcvalue(x) != x) - error("bad string mapping") -endif - -x="hello"; -if (li_std_wstring.test_ccvalue(x) != x) - error("bad string mapping") -endif - -if (li_std_wstring.test_cvalue(x) != x) - error("bad string mapping") -endif - -if (li_std_wstring.test_value(x) != x) - error("bad string mapping") -endif - -if (li_std_wstring.test_const_reference(x) != x) - error("bad string mapping") -endif - - -s = li_std_wstring.wstring("he"); -s = s + "llo"; - -if (s != x) - error("bad string mapping") -endif - -if (s(1:4) != x(1:4)) - error("bad string mapping") -endif - -if (li_std_wstring.test_value(s) != x) - error("bad string mapping") -endif - -if (li_std_wstring.test_const_reference(s) != x) - error("bad string mapping") -endif - -a = li_std_wstring.A(s); - -if (li_std_wstring.test_value(a) != x) - error("bad string mapping") -endif - -if (li_std_wstring.test_const_reference(a) != x) - error("bad string mapping") -endif - -b = li_std_wstring.wstring(" world"); - -if (a + b != "hello world") - error("bad string mapping") -endif - -if (a + " world" != "hello world") - error("bad string mapping") -endif - -if ("hello" + b != "hello world") - error("bad string mapping") -endif - -c = "hello" + b; -if (c.find_last_of("l") != 9) - error("bad string mapping") -endif - -s = "hello world"; - -b = li_std_wstring.B("hi"); - -b.name = li_std_wstring.wstring("hello"); -if (b.name != "hello") - error("bad string mapping") -endif - - -b.a = li_std_wstring.A("hello"); -if (b.a != "hello") - error("bad string mapping") -endif - - diff --git a/Examples/test-suite/python/li_std_wstring_inherit_runme.py b/Examples/test-suite/python/li_std_wstring_inherit_runme.py index 0ede5b16b..558914e7e 100644 --- a/Examples/test-suite/python/li_std_wstring_inherit_runme.py +++ b/Examples/test-suite/python/li_std_wstring_inherit_runme.py @@ -1,32 +1,7 @@ import li_std_wstring_inherit import sys -x = u"h" - -if li_std_wstring_inherit.test_wcvalue(x) != x: - print li_std_wstring_inherit.test_wcvalue(x) - raise RuntimeError("bad string mapping") - x = u"hello" -if li_std_wstring_inherit.test_ccvalue(x) != x: - raise RuntimeError("bad string mapping") - -if li_std_wstring_inherit.test_cvalue(x) != x: - raise RuntimeError("bad string mapping") - -if li_std_wstring_inherit.test_wchar_overload(x) != x: - raise RuntimeError("bad string mapping") - -if li_std_wstring_inherit.test_wchar_overload("not unicode") != "not unicode": - raise RuntimeError("bad string mapping") - -if li_std_wstring_inherit.test_value(x) != x: - print x, li_std_wstring_inherit.test_value(x) - raise RuntimeError("bad string mapping") - -if li_std_wstring_inherit.test_const_reference(x) != x: - raise RuntimeError("bad string mapping") - s = li_std_wstring_inherit.wstring(u"he") s = s + u"llo" @@ -38,20 +13,7 @@ if s != x: if s[1:4] != x[1:4]: raise RuntimeError("bad string mapping") -if li_std_wstring_inherit.test_value(s) != x: - raise RuntimeError("bad string mapping") - -if li_std_wstring_inherit.test_const_reference(s) != x: - raise RuntimeError("bad string mapping") - a = li_std_wstring_inherit.A(s) - -if li_std_wstring_inherit.test_value(a) != x: - raise RuntimeError("bad string mapping") - -if li_std_wstring_inherit.test_const_reference(a) != x: - raise RuntimeError("bad string mapping") - b = li_std_wstring_inherit.wstring(" world") if a + b != "hello world": @@ -70,8 +32,6 @@ if not li_std_wstring_inherit.is_python_builtin(): if c.find_last_of("l") != 9: raise RuntimeError("bad string mapping") -s = "hello world" - b = li_std_wstring_inherit.B("hi") b.name = li_std_wstring_inherit.wstring(u"hello") @@ -83,24 +43,3 @@ b.a = li_std_wstring_inherit.A("hello") if b.a != u"hello": raise RuntimeError("bad string mapping") -# Byte strings only converted in Python 2 -if sys.version_info[0:2] < (3, 0): - x = b"hello there" - if li_std_wstring_inherit.test_value(x) != x: - raise RuntimeError("bad string mapping") - -# Invalid utf-8 in a byte string fails in all versions -x = b"h\xe9llo" -try: - li_std_wstring_inherit.test_value(x) - raise RuntimeError("TypeError not thrown") -except TypeError: - pass - -# Check surrogateescape -if sys.version_info[0:2] > (3, 1): - x = u"h\udce9llo" # surrogate escaped representation of C char*: "h\xe9llo" - if li_std_wstring_inherit.non_utf8_c_str() != x: - raise RuntimeError("surrogateescape not working") - if li_std_wstring_inherit.size_wstring(x) != 5 and len(x) != 5: - raise RuntimeError("Unexpected length") diff --git a/Examples/test-suite/python/li_std_wstring_runme.py b/Examples/test-suite/python/li_std_wstring_runme.py index bd49a4371..c6210e2de 100644 --- a/Examples/test-suite/python/li_std_wstring_runme.py +++ b/Examples/test-suite/python/li_std_wstring_runme.py @@ -1,87 +1,60 @@ import li_std_wstring import sys -x = u"h" +def check_equal(a, b): + if a != b: + raise RuntimeError("failed {} {}".format(a, b)) -if li_std_wstring.test_wcvalue(x) != x: - print li_std_wstring.test_wcvalue(x) - raise RuntimeError("bad string mapping") +h = u"h" +check_equal(li_std_wstring.test_wcvalue(h), h) -x = u"hello" -if li_std_wstring.test_ccvalue(x) != x: - raise RuntimeError("bad string mapping") +x = u"abc" +check_equal(li_std_wstring.test_ccvalue(x), x) +check_equal(li_std_wstring.test_cvalue(x), x) -if li_std_wstring.test_cvalue(x) != x: - raise RuntimeError("bad string mapping") +check_equal(li_std_wstring.test_wchar_overload(x), x) +check_equal(li_std_wstring.test_wchar_overload(), None) -if li_std_wstring.test_wchar_overload(x) != x: - raise RuntimeError("bad string mapping") +li_std_wstring.test_pointer(None) +li_std_wstring.test_const_pointer(None) -if li_std_wstring.test_wchar_overload("not unicode") != "not unicode": - raise RuntimeError("bad string mapping") - -if li_std_wstring.test_value(x) != x: - print x, li_std_wstring.test_value(x) - raise RuntimeError("bad string mapping") - -if li_std_wstring.test_const_reference(x) != x: - raise RuntimeError("bad string mapping") - - -s = li_std_wstring.wstring(u"he") -s = s + u"llo" - -if s != x: - print s, x - raise RuntimeError("bad string mapping") - -if s[1:4] != x[1:4]: - raise RuntimeError("bad string mapping") - -if li_std_wstring.test_value(s) != x: - raise RuntimeError("bad string mapping") - -if li_std_wstring.test_const_reference(s) != x: - raise RuntimeError("bad string mapping") - -a = li_std_wstring.A(s) - -if li_std_wstring.test_value(a) != x: - raise RuntimeError("bad string mapping") - -if li_std_wstring.test_const_reference(a) != x: - raise RuntimeError("bad string mapping") - -b = li_std_wstring.wstring(" world") - -if a + b != "hello world": - raise RuntimeError("bad string mapping") - -if a + " world" != "hello world": - raise RuntimeError("bad string mapping") - -# This is expected to fail if -builtin is used -# Reverse operators not supported in builtin types -if not li_std_wstring.is_python_builtin(): - if "hello" + b != "hello world": - raise RuntimeError("bad string mapping") +try: + li_std_wstring.test_value(None) + raise RuntimeError("NULL check failed") +except TypeError as e: + pass - c = "hello" + b - if c.find_last_of("l") != 9: - raise RuntimeError("bad string mapping") +try: + li_std_wstring.test_reference(None) + raise RuntimeError("NULL check failed") +except ValueError as e: + if "invalid null reference" not in str(e): + raise RuntimeError("Missing text {}".format(e)) +try: + li_std_wstring.test_const_reference(None) + raise RuntimeError("NULL check failed") +except ValueError as e: + if "invalid null reference" not in str(e): + raise RuntimeError("Missing text {}".format(e)) -s = "hello world" +x = "hello" +check_equal(li_std_wstring.test_const_reference(x), x) -b = li_std_wstring.B("hi") +s = "abc" +if not li_std_wstring.test_equal_abc(s): + raise RuntimeError("Not equal {}".format(s)) -b.name = li_std_wstring.wstring(u"hello") -if b.name != "hello": - raise RuntimeError("bad string mapping") +try: + li_std_wstring.test_throw +except RuntimeError as e: + check_equal(e.message, "throwing test_throw") +x = "abc\0def" +check_equal(li_std_wstring.test_value(x), x) +check_equal(li_std_wstring.test_ccvalue(x), "abc") +check_equal(li_std_wstring.test_wchar_overload(x), "abc") -b.a = li_std_wstring.A("hello") -if b.a != u"hello": - raise RuntimeError("bad string mapping") +################### Python specific # Byte strings only converted in Python 2 if sys.version_info[0:2] < (3, 0): diff --git a/Examples/test-suite/ruby/li_std_wstring_inherit_runme.rb b/Examples/test-suite/ruby/li_std_wstring_inherit_runme.rb index 4a66e9fcf..b5a90d834 100644 --- a/Examples/test-suite/ruby/li_std_wstring_inherit_runme.rb +++ b/Examples/test-suite/ruby/li_std_wstring_inherit_runme.rb @@ -1,42 +1,12 @@ # -*- coding: utf-8 -*- require 'swig_assert' require 'li_std_wstring_inherit' - x = "abc" -swig_assert_equal("Li_std_wstring_inherit.test_wchar_overload(x)", "x", binding) -swig_assert_equal("Li_std_wstring_inherit.test_ccvalue(x)", "x", binding) swig_assert_equal("Li_std_wstring_inherit.test_value(Li_std_wstring_inherit::Wstring.new(x))", "x", binding) -swig_assert_equal("Li_std_wstring_inherit.test_wchar_overload()", "nil", binding) - -swig_assert_equal("Li_std_wstring_inherit.test_pointer(Li_std_wstring_inherit::Wstring.new(x))", "nil", binding) -swig_assert_equal("Li_std_wstring_inherit.test_const_pointer(Li_std_wstring_inherit::Wstring.new(x))", "nil", binding) -swig_assert_equal("Li_std_wstring_inherit.test_const_pointer(Li_std_wstring_inherit::Wstring.new(x))", "nil", binding) -swig_assert_equal("Li_std_wstring_inherit.test_reference(Li_std_wstring_inherit::Wstring.new(x))", "nil", binding) x = "y" swig_assert_equal("Li_std_wstring_inherit.test_value(x)", "x", binding) a = Li_std_wstring_inherit::A.new(x) swig_assert_equal("Li_std_wstring_inherit.test_value(a)", "x", binding) -x = "hello" -swig_assert_equal("Li_std_wstring_inherit.test_const_reference(x)", "x", binding) - - -swig_assert_equal("Li_std_wstring_inherit.test_pointer_out", "'x'", binding) -swig_assert_equal("Li_std_wstring_inherit.test_const_pointer_out", "'x'", binding) -swig_assert_equal("Li_std_wstring_inherit.test_reference_out()", "'x'", binding) - -s = "abc" -swig_assert("Li_std_wstring_inherit.test_equal_abc(s)", binding) - -begin - Li_std_wstring_inherit.test_throw -rescue RuntimeError => e - swig_assert_equal("e.message", "'x'", binding) -end - -x = "abc\0def" -swig_assert_equal("Li_std_wstring_inherit.test_value(x)", "x", binding) -swig_assert_equal("Li_std_wstring_inherit.test_ccvalue(x)", '"abc"', binding) -swig_assert_equal("Li_std_wstring_inherit.test_wchar_overload(x)", '"abc"', binding) diff --git a/Examples/test-suite/ruby/li_std_wstring_runme.rb b/Examples/test-suite/ruby/li_std_wstring_runme.rb index 0cf38ae4b..4922d8d90 100644 --- a/Examples/test-suite/ruby/li_std_wstring_runme.rb +++ b/Examples/test-suite/ruby/li_std_wstring_runme.rb @@ -2,38 +2,48 @@ require 'swig_assert' require 'li_std_wstring' +h = "h" +swig_assert_equal("Li_std_wstring.test_wcvalue(h)", "h", binding) + x = "abc" -swig_assert_equal("Li_std_wstring.test_wchar_overload(x)", "x", binding) swig_assert_equal("Li_std_wstring.test_ccvalue(x)", "x", binding) -swig_assert_equal("Li_std_wstring.test_value(Li_std_wstring::Wstring.new(x))", "x", binding) +swig_assert_equal("Li_std_wstring.test_cvalue(x)", "x", binding) +swig_assert_equal("Li_std_wstring.test_wchar_overload(x)", "x", binding) swig_assert_equal("Li_std_wstring.test_wchar_overload()", "nil", binding) -swig_assert_equal("Li_std_wstring.test_pointer(Li_std_wstring::Wstring.new(x))", "nil", binding) -swig_assert_equal("Li_std_wstring.test_const_pointer(Li_std_wstring::Wstring.new(x))", "nil", binding) -swig_assert_equal("Li_std_wstring.test_const_pointer(Li_std_wstring::Wstring.new(x))", "nil", binding) -swig_assert_equal("Li_std_wstring.test_reference(Li_std_wstring::Wstring.new(x))", "nil", binding) +Li_std_wstring.test_pointer(nil) +Li_std_wstring.test_const_pointer(nil) -x = "y" -swig_assert_equal("Li_std_wstring.test_value(x)", "x", binding) -a = Li_std_wstring::A.new(x) -swig_assert_equal("Li_std_wstring.test_value(a)", "x", binding) +begin + Li_std_wstring.test_value(nil) + raise RuntimeError, "NULL check failed" +rescue TypeError => e +end + +begin + Li_std_wstring.test_reference(nil) + raise RuntimeError, "NULL check failed" +rescue ArgumentError => e + swig_assert_simple(e.message.include? "invalid null reference") +end +begin + Li_std_wstring.test_const_reference(nil) + raise RuntimeError, "NULL check failed" +rescue ArgumentError => e + swig_assert_simple(e.message.include? "invalid null reference") +end x = "hello" swig_assert_equal("Li_std_wstring.test_const_reference(x)", "x", binding) - -swig_assert_equal("Li_std_wstring.test_pointer_out", "'x'", binding) -swig_assert_equal("Li_std_wstring.test_const_pointer_out", "'x'", binding) -swig_assert_equal("Li_std_wstring.test_reference_out()", "'x'", binding) - s = "abc" swig_assert("Li_std_wstring.test_equal_abc(s)", binding) begin Li_std_wstring.test_throw rescue RuntimeError => e - swig_assert_equal("e.message", "'x'", binding) + swig_assert_equal("e.message", "'throwing test_throw'", binding) end x = "abc\0def" -- cgit v1.2.3