diff options
author | Gregory Szorc <gregory.szorc@gmail.com> | 2012-02-17 07:47:38 +0000 |
---|---|---|
committer | Gregory Szorc <gregory.szorc@gmail.com> | 2012-02-17 07:47:38 +0000 |
commit | dd19169988da4fca1149852c67019e448f13c75f (patch) | |
tree | db9deacca39a229d8c61a3ea92942d570b7c594a /clang/bindings/python/tests | |
parent | e1e9ec1082405120888b1726f5708acd04d73f70 (diff) | |
download | bcm5719-llvm-dd19169988da4fca1149852c67019e448f13c75f.tar.gz bcm5719-llvm-dd19169988da4fca1149852c67019e448f13c75f.zip |
[clang.py] Implement Type.element_count
llvm-svn: 150800
Diffstat (limited to 'clang/bindings/python/tests')
-rw-r--r-- | clang/bindings/python/tests/cindex/test_type.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/clang/bindings/python/tests/cindex/test_type.py b/clang/bindings/python/tests/cindex/test_type.py index 3eca780d046..ba6af56e8b7 100644 --- a/clang/bindings/python/tests/cindex/test_type.py +++ b/clang/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 |