summaryrefslogtreecommitdiff
path: root/testing
diff options
context:
space:
mode:
Diffstat (limited to 'testing')
-rw-r--r--testing/cffi0/test_parsing.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/testing/cffi0/test_parsing.py b/testing/cffi0/test_parsing.py
index 5481f56..ad318ad 100644
--- a/testing/cffi0/test_parsing.py
+++ b/testing/cffi0/test_parsing.py
@@ -228,8 +228,9 @@ def test_cannot_have_only_variadic_part():
# this checks that we get a sensible error if we try "int foo(...);"
ffi = FFI()
e = py.test.raises(CDefError, ffi.cdef, "int foo(...);")
- assert str(e.value) == \
- "foo: a function with only '(...)' as argument is not correct C"
+ assert str(e.value) == (
+ "<cdef source string>:1: foo: a function with only '(...)' "
+ "as argument is not correct C")
def test_parse_error():
ffi = FFI()
@@ -291,7 +292,8 @@ def test_bool():
def test_unknown_argument_type():
ffi = FFI()
e = py.test.raises(CDefError, ffi.cdef, "void f(foobarbazzz);")
- assert str(e.value) == ("f arg 1: unknown type 'foobarbazzz' (if you meant"
+ assert str(e.value) == ("<cdef source string>:1: f arg 1:"
+ " unknown type 'foobarbazzz' (if you meant"
" to use the old C syntax of giving untyped"
" arguments, it is not supported)")
@@ -449,3 +451,9 @@ def test_extern_python_group():
ffi._parser._declarations['extern_python foobar'] !=
ffi._parser._declarations['function bok'] ==
ffi._parser._declarations['extern_python bzrrr'])
+
+def test_error_invalid_syntax_for_cdef():
+ ffi = FFI()
+ e = py.test.raises(CDefError, ffi.cdef, 'void foo(void) {}')
+ assert str(e.value) == ('<cdef source string>:1: unexpected <FuncDef>: '
+ 'this construct is valid C but not valid in cdef()')