---
bindings/python/tests/cindex/test_type.py | 39 +++++++++++++++++++++++++++++
1 files changed, 39 insertions(+), 0 deletions(-)
diff --git a/bindings/python/tests/cindex/test_type.py b/bindings/python/tests/cindex/test_type.py
index 925f93b..e7d3f30 100644
--- a/bindings/python/tests/cindex/test_type.py
+++ b/bindings/python/tests/cindex/test_type.py
@@ -283,8 +283,47 @@ def test_element_count():
assert i.type.element_count == 5
try:
j.type.element_count
assert False
except:
assert True
+
+def test_is_volatile_qualified():
+ """Ensure Type.is_volatile_qualified works."""
+
+ tu = get_tu('volatile int i = 4; int j = 2;')
+
+ i, j = None, None
+ for cursor in tu.cursor.get_children():
+ if cursor.spelling == 'i':
+ i = cursor
+ elif cursor.spelling == 'j':
+ j = cursor
+
+ ok_(i is not None)
+ ok_(j is not None)
+
+ ok_(isinstance(i.type.is_volatile_qualified(), bool))
+ ok_(i.type.is_volatile_qualified())
+ ok_(not j.type.is_volatile_qualified())
+
+def test_is_restrict_qualified():
+ """Ensure Type.is_restrict_qualified works."""
+
+ tu = get_tu('struct s { void * restrict i; void * j };', lang='c')
+ i, j = None, None
+ for cursor in tu.cursor.get_children():
+ if cursor.spelling == 's':
+ for cursor in cursor.get_children():
+ if cursor.spelling == 'i':
+ i = cursor
+ elif cursor.spelling == 'j':
+ j = cursor
+
+ ok_(i is not None)
+ ok_(j is not None)
+
+ ok_(isinstance(i.type.is_restrict_qualified(), bool))
+ ok_(i.type.is_restrict_qualified())
+ ok_(not j.type.is_restrict_qualified())
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits