1. Python CFFI
  2. Untitled project
  3. cffi

Commits

Armin Rigo  committed 9538059

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

  • Participants
  • Parent commits 61cbe88
  • Branches cpy-extension

Comments (0)

Files changed (1)

File testing/backend_tests.py

View file
             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]")