diff options
| author | mattip <matti.picus@gmail.com> | 2012-08-22 22:20:49 +0300 |
|---|---|---|
| committer | mattip <matti.picus@gmail.com> | 2012-08-22 22:20:49 +0300 |
| commit | a7d6d37ac1caf3740d6e544bf8675ea832891a61 (patch) | |
| tree | c50ce9a4029eff7b89aa6adff862d5bf6dc7bd5a /testing | |
| parent | 9b16704262e25c478989dc9732c17ae3cc1c2741 (diff) | |
| parent | ba63b2188158712097b5b6f2bc76db47cd63d77d (diff) | |
| download | cffi-win32.tar.gz | |
merge default into branchwin32
Diffstat (limited to 'testing')
| -rw-r--r-- | testing/test_parsing.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/testing/test_parsing.py b/testing/test_parsing.py index 0016239..da3b777 100644 --- a/testing/test_parsing.py +++ b/testing/test_parsing.py @@ -1,4 +1,4 @@ -import py, sys +import py, sys, re from cffi import FFI, FFIError, CDefError, VerificationError class FakeBackend(object): @@ -177,3 +177,15 @@ def test_override(): assert C.foo.BType == '<func (), <int>, False>' ffi.cdef("long foo(void);", override=True) assert C.foo.BType == '<func (), <long>, False>' + +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" + +def test_parse_error(): + ffi = FFI() + e = py.test.raises(CDefError, ffi.cdef, " x y z ") + assert re.match(r'cannot parse " x y z "\n:\d+:', str(e.value)) |
