diff --git a/SWIG/Examples/test-suite/python/Makefile.in b/SWIG/Examples/test-suite/python/Makefile.in index 090ba914b..26717f352 100644 --- a/SWIG/Examples/test-suite/python/Makefile.in +++ b/SWIG/Examples/test-suite/python/Makefile.in @@ -27,6 +27,7 @@ CPP_TEST_CASES += \ li_std_vectora \ li_std_map \ li_std_stream \ + li_std_wstream \ li_std_wstring \ nondynamic \ primitive_types \ diff --git a/SWIG/Examples/test-suite/python/li_std_wstream.i b/SWIG/Examples/test-suite/python/li_std_wstream.i new file mode 100644 index 000000000..e4d725f10 --- /dev/null +++ b/SWIG/Examples/test-suite/python/li_std_wstream.i @@ -0,0 +1,59 @@ +%module li_std_wstream + +%inline %{ + struct A; +%} + +%include +%include + + + +%callback(1) A::bar; + +%inline %{ + + struct B { + virtual ~B() + { + } + + }; + + struct A : B + { + void __add__(int a) + { + } + + void __add__(double a) + { + } + + static int bar(int a){ + return a; + } + + static int foo(int a, int (*pf)(int a)) + { + return pf(a); + } + + + std::wostream& __rlshift__(std::wostream& out) + { + out << "A class"; + return out; + } + }; +%} + +%extend std::basic_ostream{ + std::basic_ostream& + operator<<(const A& a) + { + *self << "A class"; + return *self; + } +} + diff --git a/SWIG/Examples/test-suite/python/li_std_wstream_runme.py b/SWIG/Examples/test-suite/python/li_std_wstream_runme.py new file mode 100644 index 000000000..74c3c4d4b --- /dev/null +++ b/SWIG/Examples/test-suite/python/li_std_wstream_runme.py @@ -0,0 +1,14 @@ +import li_std_wstream as std + + + +a = std.A() + +o = std.wostringstream() + +o << a << u" " << 2345 << u" " << 1.435 + + +if o.str() != "A class 2345 1.435": + print "\"%s\"" % (o.str(),) + raise RuntimeError