diff options
author | Tobias Grosser <grosser@fim.uni-passau.de> | 2012-02-05 11:42:20 +0000 |
---|---|---|
committer | Tobias Grosser <grosser@fim.uni-passau.de> | 2012-02-05 11:42:20 +0000 |
commit | 28d939ffd6877f8a2c6a5b6704df792319f3878e (patch) | |
tree | 660bc5a486dc04baa54382536f477a923cc4ff77 /bindings/python/tests | |
parent | 250d217586b0dafcb0be343a80da31c956258e2e (diff) |
[clang.py] Implement Cursor.underlying_typedef_type
Contributed by: Gregory Szorc <gregory.szorc@gmail.com>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149829 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'bindings/python/tests')
-rw-r--r-- | bindings/python/tests/cindex/test_cursor.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/bindings/python/tests/cindex/test_cursor.py b/bindings/python/tests/cindex/test_cursor.py index efcede9015..d86830334d 100644 --- a/bindings/python/tests/cindex/test_cursor.py +++ b/bindings/python/tests/cindex/test_cursor.py @@ -62,3 +62,18 @@ def test_get_children(): assert tu_nodes[2].spelling == 'f0' assert tu_nodes[2].displayname == 'f0(int, int)' assert tu_nodes[2].is_definition() == True + +def test_underlying_type(): + source = 'typedef int foo;' + index = Index.create() + tu = index.parse('test.c', unsaved_files=[('test.c', source)]) + assert tu is not None + + for cursor in tu.cursor.get_children(): + if cursor.spelling == 'foo': + typedef = cursor + break + + assert typedef.kind.is_declaration() + underlying = typedef.underlying_typedef_type + assert underlying.kind == TypeKind.INT |