[pypy-commit] cffi default: Add a passing test.
arigo
noreply at buildbot.pypy.org
Tue Jun 26 11:03:55 CEST 2012
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r519:c6f652a8310e
Date: 2012-06-26 11:00 +0200
http://bitbucket.org/cffi/cffi/changeset/c6f652a8310e/
Log: Add a passing test.
diff --git a/testing/test_verify.py b/testing/test_verify.py
--- a/testing/test_verify.py
+++ b/testing/test_verify.py
@@ -518,3 +518,22 @@
return x;
}
""")
+
+def test_varargs_struct():
+ ffi = FFI()
+ ffi.cdef("struct foo_s { char a; int b; }; int foo(int x, ...);")
+ lib = ffi.verify("""
+ struct foo_s {
+ char a; int b;
+ };
+ int foo(int x, ...) {
+ va_list vargs;
+ struct foo_s s;
+ va_start(vargs, x);
+ s = va_arg(vargs, struct foo_s);
+ va_end(vargs);
+ return s.a - s.b;
+ }
+ """)
+ s = ffi.new("struct foo_s", ['B', 1])
+ assert lib.foo(50, s[0]) == ord('A')
More information about the pypy-commit
mailing list