Author: Armin Rigo <[email protected]>
Branch: 
Changeset: r2742:1362f9f5048a
Date: 2016-08-22 16:01 +0200
http://bitbucket.org/cffi/cffi/changeset/1362f9f5048a/

Log:    Add two tests for 34b29a139894

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
@@ -1962,3 +1962,21 @@
                        ffi, "test_function_returns_opaque", "?")
     assert str(e.value) == ("function foo: 'struct a' is used as result type,"
                             " but is opaque")
+
+def test_function_returns_union():
+    ffi = FFI()
+    ffi.cdef("union u1 { int a, b; }; union u1 f1(int);")
+    lib = verify(ffi, "test_function_returns_union", """
+        union u1 { int a, b; };
+        static union u1 f1(int x) { union u1 u; u.b = x; return u; }
+    """)
+    assert lib.f1(51).a == 51
+
+def test_function_returns_partial_struct():
+    ffi = FFI()
+    ffi.cdef("struct a { int a; ...; }; struct a f1(int);")
+    lib = verify(ffi, "test_function_returns_partial_struct", """
+        struct a { int b, a, c; };
+        static struct a f1(int x) { struct a s = {0}; s.a = x; return s; }
+    """)
+    assert lib.f1(52).a == 52
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to