diff options
Diffstat (limited to 'testing/cffi0/test_function.py')
-rw-r--r-- | testing/cffi0/test_function.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/testing/cffi0/test_function.py b/testing/cffi0/test_function.py index 6312707..4f2c864 100644 --- a/testing/cffi0/test_function.py +++ b/testing/cffi0/test_function.py @@ -240,6 +240,23 @@ class TestFunction(object): else: assert "None" in printed + def test_callback_returning_struct_three_bytes(self): + if self.Backend is CTypesBackend: + py.test.skip("not supported with the ctypes backend") + ffi = FFI(backend=self.Backend()) + ffi.cdef(""" + typedef struct { + unsigned char a, b, c; + } THREEBYTES; + """) + def cb(): + return (12, 34, 56) + fptr = ffi.callback("THREEBYTES(*)(void)", cb) + tb = fptr() + assert tb.a == 12 + assert tb.b == 34 + assert tb.c == 56 + def test_passing_array(self): ffi = FFI(backend=self.Backend()) ffi.cdef(""" |