summaryrefslogtreecommitdiff
path: root/testing/cffi0/test_verify.py
diff options
context:
space:
mode:
authorArmin Rigo <arigo@tunes.org>2015-06-02 15:56:31 +0200
committerArmin Rigo <arigo@tunes.org>2015-06-02 15:56:31 +0200
commit5c4f9ba700b3466717c5ddfc9011bf94dea8d32d (patch)
treeff4dd4259acc231a21b341eb7b550321ede5dd42 /testing/cffi0/test_verify.py
parent8d296fa725a50b050e05ebe5e6601655b82324ce (diff)
downloadcffi-5c4f9ba700b3466717c5ddfc9011bf94dea8d32d.tar.gz
Test and fix for ffi.verify() only on PyPy (thanks Alex Gaynor for
pointing it out)
Diffstat (limited to 'testing/cffi0/test_verify.py')
-rw-r--r--testing/cffi0/test_verify.py8
1 files changed, 8 insertions, 0 deletions
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