Author: Armin Rigo <[email protected]>
Branch: ffi-backend
Changeset: r56470:e2d0cbaa8bbd
Date: 2012-07-26 13:19 +0200
http://bitbucket.org/pypy/pypy/changeset/e2d0cbaa8bbd/
Log: Import test from hg/cffi/c
diff --git a/pypy/module/_cffi_backend/test/_backend_test_c.py
b/pypy/module/_cffi_backend/test/_backend_test_c.py
--- a/pypy/module/_cffi_backend/test/_backend_test_c.py
+++ b/pypy/module/_cffi_backend/test/_backend_test_c.py
@@ -1595,6 +1595,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
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit