Author: Armin Rigo <[email protected]>
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')
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to