summaryrefslogtreecommitdiff
path: root/testing/test_function.py
diff options
context:
space:
mode:
authorArmin Rigo <arigo@tunes.org>2013-04-06 12:35:59 +0200
committerArmin Rigo <arigo@tunes.org>2013-04-06 12:35:59 +0200
commitc3c43925a685e8e9157a2f236c0f2e55e7691081 (patch)
tree0a8e99cee62075d605cae14a3c51bcdc4780444e /testing/test_function.py
parent0575e29031d9b8c2d66df83e308824143eec12b0 (diff)
parent335d19f59213e0ac2e6129d0494addde12863659 (diff)
downloadcffi-c3c43925a685e8e9157a2f236c0f2e55e7691081.tar.gz
Merged in pjenvey/cffi (pull request #13)
Diffstat (limited to 'testing/test_function.py')
-rw-r--r--testing/test_function.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/testing/test_function.py b/testing/test_function.py
index c3e8d99..49e7b64 100644
--- a/testing/test_function.py
+++ b/testing/test_function.py
@@ -346,6 +346,31 @@ class TestFunction(object):
assert lib.EE == -5
assert lib.FF == -4
+ def test_void_star_accepts_string(self):
+ ffi = FFI(backend=self.Backend())
+ ffi.cdef("""int strlen(const void *);""")
+ lib = ffi.dlopen(None)
+ res = lib.strlen(b"hello")
+ assert res == 5
+
+ def test_signed_char_star_accepts_string(self):
+ if self.Backend is CTypesBackend:
+ py.test.skip("not supported by the ctypes backend")
+ ffi = FFI(backend=self.Backend())
+ ffi.cdef("""int strlen(signed char *);""")
+ lib = ffi.dlopen(None)
+ res = lib.strlen(b"hello")
+ assert res == 5
+
+ def test_unsigned_char_star_accepts_string(self):
+ if self.Backend is CTypesBackend:
+ py.test.skip("not supported by the ctypes backend")
+ ffi = FFI(backend=self.Backend())
+ ffi.cdef("""int strlen(unsigned char *);""")
+ lib = ffi.dlopen(None)
+ res = lib.strlen(b"hello")
+ assert res == 5
+
def test_missing_function(self):
ffi = FFI(backend=self.Backend())
ffi.cdef("""