[pypy-commit] cffi cffi-1.0: Add a passing test

arigo noreply at buildbot.pypy.org
Fri May 8 18:03:16 CEST 2015


Author: Armin Rigo <arigo at tunes.org>
Branch: cffi-1.0
Changeset: r1933:2e36923f3024
Date: 2015-05-08 18:03 +0200
http://bitbucket.org/cffi/cffi/changeset/2e36923f3024/

Log:	Add a passing test

diff --git a/_cffi1/test_ffi_obj.py b/_cffi1/test_ffi_obj.py
--- a/_cffi1/test_ffi_obj.py
+++ b/_cffi1/test_ffi_obj.py
@@ -142,3 +142,18 @@
     assert ffi.cast("int(*)(int)", 0) == ffi.NULL
     ffi.callback("int(int)")      # side-effect of registering this string
     py.test.raises(ffi.error, ffi.cast, "int(int)", 0)
+
+def test_ffi_invalid_type():
+    ffi = _cffi1_backend.FFI()
+    e = py.test.raises(ffi.error, ffi.cast, "", 0)
+    assert str(e.value) == ("identifier expected\n"
+                            "\n"
+                            "^")
+    e = py.test.raises(ffi.error, ffi.cast, "struct struct", 0)
+    assert str(e.value) == ("struct or union name expected\n"
+                            "struct struct\n"
+                            "       ^")
+    e = py.test.raises(ffi.error, ffi.cast, "struct never_heard_of_s", 0)
+    assert str(e.value) == ("undefined struct/union name\n"
+                            "struct never_heard_of_s\n"
+                            "       ^")


More information about the pypy-commit mailing list