swig/Examples/test-suite/python/li_std_wstring_runme.py
Stefan Zager 002598680e This commit contains all changes to the regression tests which
are necessitated by the -builtin option.  Notes on individual tests
follow.

grouping_runme.py : 'cvar' syntax for class variables is obsolete.

li_std_string_extra_runme.py :
li_std_wstring_runme.py : Reverse binary operators (e.g., __radd__)
are not supported.

threads_exception_runme.py :
director_exception_runme.py :
exception_order_runme.py : Throwing wrapped objects as exceptions
is not supported.

default_constructor_runme.py : Redundant functional interface
(e.g., 'module.new_Foo()' for 'module.Foo()') is not provided.

python_nondynamic_runme.py : I believe that this test script doesn't
actually test the %pythonnondynamic feature correctly, and I believe
that the feature itself is implemented incorrectly.  With the -builtin
option, %pythonnondynamic *is* implemented correctly, and I have
modified the test script to exercise it correctly.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/szager-python-builtin@12416 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-01-30 04:13:58 +00:00

78 lines
1.8 KiB
Python

import li_std_wstring
x=u"h"
if li_std_wstring.test_wcvalue(x) != x:
print li_std_wstring.test_wcvalue(x)
raise RuntimeError, "bad string mapping"
x=u"hello"
if li_std_wstring.test_ccvalue(x) != x:
raise RuntimeError, "bad string mapping"
if li_std_wstring.test_cvalue(x) != x:
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"
# With -builtin option, no reverse binary operators
#if "hello" + b != "hello world":
# raise RuntimeError, "bad string mapping"
# With -builtin option, no reverse binary operators
#c = "hello" + b
#if c.find_last_of("l") != 9:
# raise RuntimeError, "bad string mapping"
s = "hello world"
b = li_std_wstring.B("hi")
b.name = li_std_wstring.wstring(u"hello")
if b.name != "hello":
raise RuntimeError, "bad string mapping"
b.a = li_std_wstring.A("hello")
if b.a != u"hello":
raise RuntimeError, "bad string mapping"