[pypy-commit] cffi cffi-1.0: more test fixes
arigo
noreply at buildbot.pypy.org
Sat Apr 25 11:42:01 CEST 2015
Author: Armin Rigo <arigo at tunes.org>
Branch: cffi-1.0
Changeset: r1815:c2023e4a4a6d
Date: 2015-04-25 11:42 +0200
http://bitbucket.org/cffi/cffi/changeset/c2023e4a4a6d/
Log: more test fixes
diff --git a/_cffi1/test_verify1.py b/_cffi1/test_verify1.py
--- a/_cffi1/test_verify1.py
+++ b/_cffi1/test_verify1.py
@@ -1139,10 +1139,12 @@
assert lib.BB == 1
def test_typedef_broken_complete_enum():
+ # xxx this is broken in old cffis, but works with recompiler.py
ffi = FFI()
ffi.cdef("typedef enum { AA, BB } enum1_t;")
- py.test.raises(VerificationError, ffi.verify,
- "typedef enum { AA, CC, BB } enum1_t;")
+ lib = ffi.verify("typedef enum { AA, CC, BB } enum1_t;")
+ assert lib.AA == 0
+ assert lib.BB == 2
def test_typedef_incomplete_enum():
ffi = FFI()
@@ -1723,18 +1725,17 @@
def test_enum_bug118():
maxulong = 256 ** FFI().sizeof("unsigned long") - 1
- for c1, c2, c2c in [(0xffffffff, -1, ''),
- (maxulong, -1, ''),
- (-1, 0xffffffff, 'U'),
- (-1, maxulong, 'UL')]:
+ for c2, c2c in [(-1, ''),
+ (-1, ''),
+ (0xffffffff, 'U'),
+ (maxulong, 'UL'),
+ (-maxulong / 3, 'L')]:
if c2c and sys.platform == 'win32':
continue # enums may always be signed with MSVC
ffi = FFI()
- ffi.cdef("enum foo_e { AA=%s };" % c1)
- e = py.test.raises(VerificationError, ffi.verify,
- "enum foo_e { AA=%s%s };" % (c2, c2c))
- assert str(e.value) == ('enum foo_e: AA has the real value %d, not %d'
- % (c2, c1))
+ ffi.cdef("enum foo_e { AA };")
+ lib = ffi.verify("enum foo_e { AA=%s%s };" % (c2, c2c))
+ assert lib.AA == c2
def test_string_to_voidp_arg():
ffi = FFI()
More information about the pypy-commit
mailing list