[pypy-commit] cffi default: An extra test
arigo
noreply at buildbot.pypy.org
Sat Jan 18 18:39:57 CET 2014
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r1455:22a6af557fbc
Date: 2014-01-14 14:17 +0100
http://bitbucket.org/cffi/cffi/changeset/22a6af557fbc/
Log: An extra test
diff --git a/testing/test_verify.py b/testing/test_verify.py
--- a/testing/test_verify.py
+++ b/testing/test_verify.py
@@ -1855,3 +1855,24 @@
def test_various_calls_libffi():
_test_various_calls(force_libffi=True)
+
+def test_ptr_to_opaque():
+ ffi = FFI()
+ ffi.cdef("typedef ... foo_t; int f1(foo_t*); foo_t *f2(int);")
+ lib = ffi.verify("""
+ #include <stdlib.h>
+ typedef struct { int x; } foo_t;
+ int f1(foo_t* p) {
+ int x = p->x;
+ free(p);
+ return x;
+ }
+ foo_t *f2(int x) {
+ foo_t *p = malloc(sizeof(foo_t));
+ p->x = x;
+ return p;
+ }
+ """)
+ p = lib.f2(42)
+ x = lib.f1(p)
+ assert x == 42
More information about the pypy-commit
mailing list