aboutsummaryrefslogtreecommitdiff
path: root/bindings/python/tests/cindex/test_cursor.py
diff options
context:
space:
mode:
authorGregory Szorc <gregory.szorc@gmail.com>2012-05-14 03:56:33 +0000
committerGregory Szorc <gregory.szorc@gmail.com>2012-05-14 03:56:33 +0000
commit2c40835c21cd435f183da3d4754aff6beeaef9f6 (patch)
tree51dc53a61cccc7f2b5948f03d0bd26d27b53eb44 /bindings/python/tests/cindex/test_cursor.py
parent1e370ab68e5b69fc40a782ee5ce01ec2c6857879 (diff)
[clang.py] Implement Cursor.canonical
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156753 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'bindings/python/tests/cindex/test_cursor.py')
-rw-r--r--bindings/python/tests/cindex/test_cursor.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/bindings/python/tests/cindex/test_cursor.py b/bindings/python/tests/cindex/test_cursor.py
index 206d9c8521..c80cf10ebe 100644
--- a/bindings/python/tests/cindex/test_cursor.py
+++ b/bindings/python/tests/cindex/test_cursor.py
@@ -67,6 +67,18 @@ def test_get_children():
assert tu_nodes[2].displayname == 'f0(int, int)'
assert tu_nodes[2].is_definition() == True
+def test_canonical():
+ source = 'struct X; struct X; struct X { int member; };'
+ tu = get_tu(source)
+
+ cursors = []
+ for cursor in tu.cursor.get_children():
+ if cursor.spelling == 'X':
+ cursors.append(cursor)
+
+ assert len(cursors) == 3
+ assert cursors[1].canonical == cursors[2].canonical
+
def test_underlying_type():
tu = get_tu('typedef int foo;')
typedef = get_cursor(tu, 'foo')