summaryrefslogtreecommitdiffstats
path: root/bindings/python/tests
diff options
context:
space:
mode:
authorGregory Szorc <gregory.szorc@gmail.com>2012-02-17 07:47:38 +0000
committerGregory Szorc <gregory.szorc@gmail.com>2012-02-17 07:47:38 +0000
commitbf8ca0049ea4faa7b089001e837e0ebbaec2ac6d (patch)
tree781bc8fdf65790478a49a36b64706d6d02590a14 /bindings/python/tests
parent860576050b4d163a2f182cfdd67d8c5a48e32c08 (diff)
[clang.py] Implement Type.element_count
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150800 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'bindings/python/tests')
-rw-r--r--bindings/python/tests/cindex/test_type.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/bindings/python/tests/cindex/test_type.py b/bindings/python/tests/cindex/test_type.py
index 3eca780d04..ba6af56e8b 100644
--- a/bindings/python/tests/cindex/test_type.py
+++ b/bindings/python/tests/cindex/test_type.py
@@ -147,3 +147,25 @@ def test_invalid_element_type():
ok_(i is not None)
i.element_type
+
+def test_element_count():
+ index = Index.create()
+ tu = index.parse('t.c', unsaved_files=[('t.c', 'int i[5]; int j;')])
+ assert tu is not None
+
+ for cursor in tu.cursor.get_children():
+ if cursor.spelling == 'i':
+ i = cursor
+ elif cursor.spelling == 'j':
+ j = cursor
+
+ assert i is not None
+ assert j is not None
+
+ assert i.type.element_count == 5
+
+ try:
+ j.type.element_count
+ assert False
+ except:
+ assert True