From 5c4f9ba700b3466717c5ddfc9011bf94dea8d32d Mon Sep 17 00:00:00 2001 From: Armin Rigo Date: Tue, 2 Jun 2015 15:56:31 +0200 Subject: Test and fix for ffi.verify() only on PyPy (thanks Alex Gaynor for pointing it out) --- testing/cffi0/test_verify.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'testing') diff --git a/testing/cffi0/test_verify.py b/testing/cffi0/test_verify.py index 3e67e67..3bc10d5 100644 --- a/testing/cffi0/test_verify.py +++ b/testing/cffi0/test_verify.py @@ -2227,3 +2227,11 @@ def test_static_const_int_wrong_value(): ffi.cdef("static const int FOO = 123;") e = py.test.raises(VerificationError, ffi.verify, "#define FOO 124") assert str(e.value).endswith("FOO has the real value 124, not 123") + +def test_const_struct_global(): + ffi = FFI() + ffi.cdef("typedef struct { int x; ...; } T; const T myglob;") + lib = ffi.verify("typedef struct { double y; int x; } T;" + "const T myglob = { 0.1, 42 };") + assert ffi.typeof(lib.myglob) == ffi.typeof("T") + assert lib.myglob.x == 42 -- cgit v1.2.1