summaryrefslogtreecommitdiff
path: root/tests/test_domain_c.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_domain_c.py')
-rw-r--r--tests/test_domain_c.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/test_domain_c.py b/tests/test_domain_c.py
index 009f51644..d89e169c3 100644
--- a/tests/test_domain_c.py
+++ b/tests/test_domain_c.py
@@ -354,6 +354,21 @@ def test_function_definitions():
check('function', 'void f(enum E e)', {1: 'f'})
check('function', 'void f(union E e)', {1: 'f'})
+ # array declarators
+ check('function', 'void f(int arr[])', {1: 'f'})
+ check('function', 'void f(int arr[*])', {1: 'f'})
+ cvrs = ['', 'const', 'volatile', 'restrict', 'restrict volatile const']
+ for cvr in cvrs:
+ space = ' ' if len(cvr) != 0 else ''
+ check('function', 'void f(int arr[{}*])'.format(cvr), {1: 'f'})
+ check('function', 'void f(int arr[{}])'.format(cvr), {1: 'f'})
+ check('function', 'void f(int arr[{}{}42])'.format(cvr, space), {1: 'f'})
+ check('function', 'void f(int arr[static{}{} 42])'.format(space, cvr), {1: 'f'})
+ check('function', 'void f(int arr[{}{}static 42])'.format(cvr, space), {1: 'f'},
+ output='void f(int arr[static{}{} 42])'.format(space, cvr))
+ check('function', 'void f(int arr[const static volatile 42])', {1: 'f'},
+ output='void f(int arr[static volatile const 42])')
+
def test_union_definitions():
check('struct', 'A', {1: 'A'})