Author: Armin Rigo <ar...@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" + " ^") _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit