diff options
author | Eli Bendersky <eliben@gmail.com> | 2021-08-28 08:01:32 -0700 |
---|---|---|
committer | Eli Bendersky <eliben@gmail.com> | 2021-08-28 08:01:32 -0700 |
commit | 7d9a6d96af0828892bc296aedbf35bc81482e8ac (patch) | |
tree | 04e7b0624e1bae4192f7dcbfc1013559137ee0b7 | |
parent | cd50d04deb899ed4acd04b54f00b28dc17c19ede (diff) | |
download | pycparser-7d9a6d96af0828892bc296aedbf35bc81482e8ac.tar.gz |
Add thornier tests for nested pointers with qualifiers in declarations
-rwxr-xr-x | tests/test_c_parser.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/test_c_parser.py b/tests/test_c_parser.py index 4688c3b..11717a5 100755 --- a/tests/test_c_parser.py +++ b/tests/test_c_parser.py @@ -348,6 +348,11 @@ class TestCParser_fundamentals(TestCParser_base): ['PtrDecl', ['PtrDecl', ['const'], ['TypeDecl', ['IdentifierType', ['char']]]]]]) + self.assertEqual(self.get_decl('const char* const* p;'), + ['Decl', ['const'], 'p', + ['PtrDecl', ['PtrDecl', ['const'], + ['TypeDecl', ['IdentifierType', ['char']]]]]]) + self.assertEqual(self.get_decl('char* * const p;'), ['Decl', 'p', ['PtrDecl', ['const'], ['PtrDecl', @@ -761,6 +766,19 @@ class TestCParser_fundamentals(TestCParser_base): self.assertEqual(expand_decl(ps5.ext[0]), ['Typedef', 'Hash', ['TypeDecl', ['Struct', 'tagHash', []]]]) + s6 = '''typedef int (* const * const T)(void);''' + ps6 = self.parse(s6) + self.assertEqual(expand_decl(ps6.ext[0]), + ['Typedef', + 'T', + ['PtrDecl', + ['const'], + ['PtrDecl', + ['const'], + ['FuncDecl', + [['Typename', ['TypeDecl', ['IdentifierType', ['void']]]]], + ['TypeDecl', ['IdentifierType', ['int']]]]]]]) + def test_struct_union(self): s1 = """ struct { |