[pypy-commit] cffi default: add a passing test

arigo noreply at buildbot.pypy.org
Thu May 28 19:19:38 CEST 2015


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r2125:020ef1915196
Date: 2015-05-28 19:20 +0200
http://bitbucket.org/cffi/cffi/changeset/020ef1915196/

Log:	add a passing test

diff --git a/testing/cffi1/test_recompiler.py b/testing/cffi1/test_recompiler.py
--- a/testing/cffi1/test_recompiler.py
+++ b/testing/cffi1/test_recompiler.py
@@ -892,3 +892,18 @@
         extern const int external_foo;
     """, sources=[str(extra_c_source)])
     assert lib.external_foo == 42
+
+def test_call_with_incomplete_structs():
+    ffi = FFI()
+    ffi.cdef("typedef struct {...;} foo_t; "
+             "foo_t myglob; "
+             "foo_t increment(foo_t s); "
+             "double getx(foo_t s);")
+    lib = verify(ffi, 'test_call_with_incomplete_structs', """
+        typedef double foo_t;
+        double myglob = 42.5;
+        double getx(double x) { return x; }
+        double increment(double x) { return x + 1; }
+    """)
+    assert lib.getx(lib.myglob) == 42.5
+    assert lib.getx(lib.increment(lib.myglob)) == 43.5


More information about the pypy-commit mailing list