diff options
| author | Armin Rigo <arigo@tunes.org> | 2015-10-04 19:21:40 +0200 |
|---|---|---|
| committer | Armin Rigo <arigo@tunes.org> | 2015-10-04 19:21:40 +0200 |
| commit | 730c61f68b775fc0daaa6e9f93ed1e76366eb2c9 (patch) | |
| tree | 44041d7f58a3ccf5ccc66fde52e6120f7a47c944 | |
| parent | 49adcd142433ecbbeaecad246a91439a66ca3a06 (diff) | |
| download | cffi-cmacros.tar.gz | |
more testscmacros
| -rw-r--r-- | testing/cffi0/test_parsing.py | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/testing/cffi0/test_parsing.py b/testing/cffi0/test_parsing.py index 8ca8c5f..16c8da9 100644 --- a/testing/cffi0/test_parsing.py +++ b/testing/cffi0/test_parsing.py @@ -511,13 +511,13 @@ def test_conditional_typedef_used_by_func_2(): #else typedef long foo_t; #endif - foo_t foo(char); + foo_t *foo(char); """) case = ffi._parser._declarations['function foo'] assert isinstance(case, ConditionalCase) assert case.condition == 'defined(ABC)' - assert str(case.iftrue) == '<func (<char>), <int>, False>' - assert str(case.iffalse) == '<func (<char>), <long>, False>' + assert str(case.iftrue) == '<func (<char>), <pointer to <int>>, False>' + assert str(case.iffalse) == '<func (<char>), <pointer to <long>>, False>' def test_conditional_typedef_not_used_by_func(): ffi = FFI(backend=FakeBackend()) @@ -532,6 +532,27 @@ def test_conditional_typedef_not_used_by_func(): case = ffi._parser._declarations['function foo'] assert str(case) == '<func (<char>), <char>, False>' +def test_conditional_typedef_partially_defined_1(): + ffi = FFI(backend=FakeBackend()) + ffi.cdef(""" + #ifdef ABC + typedef int foo_t; + #endif + char foo(char); + """) + case = ffi._parser._declarations['function foo'] + assert str(case) == '<func (<char>), <char>, False>' + +def test_conditional_typedef_partially_defined_2(): + ffi = FFI(backend=FakeBackend()) + ffi.cdef(""" + #ifdef ABC + typedef int foo_t; + #endif + char foo(foo_t *); + """) + should_crash + def test_conditional_nested(): ffi = FFI(backend=FakeBackend()) ffi.cdef(""" |
