Author: Armin Rigo <ar...@tunes.org> Branch: Changeset: r683:d2d264ed6e95 Date: 2012-07-26 13:18 +0200 http://bitbucket.org/cffi/cffi/changeset/d2d264ed6e95/
Log: Test an invalid cast (in this case, cast-to-struct-type) diff --git a/c/test_c.py b/c/test_c.py --- a/c/test_c.py +++ b/c/test_c.py @@ -1605,6 +1605,13 @@ x = cast(BArray, 0) assert repr(x) == "<cdata 'int[3]' NULL>" +def test_cast_invalid(): + BStruct = new_struct_type("foo") + complete_struct_or_union(BStruct, []) + p = cast(new_pointer_type(BStruct), 123456) + s = p[0] + py.test.raises(TypeError, cast, BStruct, s) + def test_bug_float_convertion(): BDouble = new_primitive_type("double") BDoubleP = new_pointer_type(BDouble) _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit