Commit c35d533b authored by Stefan Behnel's avatar Stefan Behnel

extend C++ std::string tests to cover ticket 783

parent bf66d45c
......@@ -167,6 +167,29 @@ def test_decode(char* a):
cdef string b = string(a)
return b.decode('ascii')
@cython.test_assert_path_exists("//ReturnStatNode//PythonCapiCallNode")
def test_cstr_decode(char* a):
"""
>>> print(test_cstr_decode(b_asdf))
asdf
"""
cdef string b = string(a)
return b.c_str().decode('utf-8')
@cython.test_assert_path_exists("//ReturnStatNode//PythonCapiCallNode")
@cython.test_fail_if_path_exists("//ReturnStatNode//AttributeNode")
def test_cstr_ptr_decode(char* a):
"""
>>> print(test_cstr_ptr_decode(b_asdf))
asdf
"""
cdef string b = string(a)
s = b.c_str()
return s.decode('utf-8')
@cython.test_assert_path_exists("//PythonCapiCallNode")
@cython.test_fail_if_path_exists("//AttributeNode")
def test_decode_sliced(char* a):
......
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