diff options
author | Gregory Szorc <gregory.szorc@gmail.com> | 2012-05-14 03:56:33 +0000 |
---|---|---|
committer | Gregory Szorc <gregory.szorc@gmail.com> | 2012-05-14 03:56:33 +0000 |
commit | 8eac05c3623c95ff4a29560029626dd852522b51 (patch) | |
tree | 1d07d93a8db433207a927e7fc519dd3b965584da /clang/bindings/python/tests/cindex/test_cursor.py | |
parent | 71efa09fa7e4914689bba401453bc98a355393bd (diff) | |
download | bcm5719-llvm-8eac05c3623c95ff4a29560029626dd852522b51.tar.gz bcm5719-llvm-8eac05c3623c95ff4a29560029626dd852522b51.zip |
[clang.py] Implement Cursor.canonical
llvm-svn: 156753
Diffstat (limited to 'clang/bindings/python/tests/cindex/test_cursor.py')
-rw-r--r-- | clang/bindings/python/tests/cindex/test_cursor.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/bindings/python/tests/cindex/test_cursor.py b/clang/bindings/python/tests/cindex/test_cursor.py index 206d9c85210..c80cf10ebec 100644 --- a/clang/bindings/python/tests/cindex/test_cursor.py +++ b/clang/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') |