[pypy-commit] cffi cpy-extension: Add a skipped test about C99 trailing open-ended arrays in structs.

arigo noreply at buildbot.pypy.org
Wed Jun 13 22:12:17 CEST 2012


Author: Armin Rigo <arigo at tunes.org>
Branch: cpy-extension
Changeset: r315:95380599eabb
Date: 2012-06-13 22:12 +0200
http://bitbucket.org/cffi/cffi/changeset/95380599eabb/

Log:	Add a skipped test about C99 trailing open-ended arrays in structs.

diff --git a/testing/backend_tests.py b/testing/backend_tests.py
--- a/testing/backend_tests.py
+++ b/testing/backend_tests.py
@@ -766,3 +766,12 @@
             assert s == '\x64\x00\x00\x00\x65\x00\x00\x00'
         else:
             assert s == '\x00\x00\x00\x64\x00\x00\x00\x65'
+
+    def test_new_struct_containing_array_varsize(self):
+        py.test.skip("later?")
+        ffi = FFI(backend=_ffi_backend)
+        ffi.cdef("struct foo_s { int len; short data[]; };")
+        p = ffi.new("struct foo_s", 10)     # a single integer is the length
+        assert p.len == 0
+        assert p.data[9] == 0
+        py.test.raises(IndexError, "p.data[10]")


More information about the pypy-commit mailing list