[pypy-commit] cffi cpy-extension: Add a passing test

arigo noreply at buildbot.pypy.org
Wed Jun 13 21:34:33 CEST 2012


Author: Armin Rigo <arigo at tunes.org>
Branch: cpy-extension
Changeset: r312:5614459396f6
Date: 2012-06-13 21:34 +0200
http://bitbucket.org/cffi/cffi/changeset/5614459396f6/

Log:	Add a passing test

diff --git a/c/test_c.py b/c/test_c.py
--- a/c/test_c.py
+++ b/c/test_c.py
@@ -460,6 +460,15 @@
     assert s.a2 == 456
     assert s.a3 == 0
 
+def test_array_in_struct():
+    BInt = new_primitive_type("int")
+    BStruct = new_struct_type("foo")
+    BArrayInt5 = new_array_type(new_pointer_type(BInt), 5)
+    complete_struct_or_union(BStruct, [('a1', BArrayInt5, -1)])
+    s = newp(new_pointer_type(BStruct), [[20, 24, 27, 29, 30]])
+    assert s.a1[2] == 27
+    assert repr(s.a1) == "<cdata 'int[5]'>"
+
 def test_offsetof():
     BInt = new_primitive_type("int")
     BStruct = new_struct_type("foo")


More information about the pypy-commit mailing list