Commit 05cbb319 authored by Robert Bradshaw's avatar Robert Bradshaw

Test for typedef cpp strings.

parent d1be46e1
...@@ -36,6 +36,8 @@ class MyString2 : public MyString { ...@@ -36,6 +36,8 @@ class MyString2 : public MyString {
MyString2(const char* data, size_t size) : MyString(data, size) { } MyString2(const char* data, size_t size) : MyString(data, size) { }
}; };
typedef MyString MyTypedefString;
######## a.pyx ######## ######## a.pyx ########
# distutils: language = c++ # distutils: language = c++
...@@ -44,19 +46,26 @@ cdef extern from "my_string.cpp": ...@@ -44,19 +46,26 @@ cdef extern from "my_string.cpp":
cdef cppclass MyString: cdef cppclass MyString:
pass pass
cdef extern from "my_string.cpp":
cdef cppclass MyString2: cdef cppclass MyString2:
pass pass
ctypedef MyString2 MyTypedefString # really a MyString
def do_convert(MyString value): def do_convert(MyString value):
return value return value
def do_convert2(MyString2 value): def do_convert2(MyString2 value):
return value return value
def do_convert_typedef(MyTypedefString value):
return value
def test_convert(): def test_convert():
assert do_convert(b"abc") == b"abc" assert do_convert(b"abc") == b"abc"
assert do_convert(b"ab\0c") == b"ab\0c" assert do_convert(b"ab\0c") == b"ab\0c"
assert do_convert2(b"abc") == b"abc" assert do_convert2(b"abc") == b"abc"
assert do_convert2(b"ab\0c") == b"ab\0c" assert do_convert2(b"ab\0c") == b"ab\0c"
assert do_convert_typedef(b"abc") == "abc"
assert do_convert_typedef(b"ab\0c") == b"ab\0c"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment