diff options
author | Gregory Szorc <gregory.szorc@gmail.com> | 2012-07-12 07:21:12 +0000 |
---|---|---|
committer | Gregory Szorc <gregory.szorc@gmail.com> | 2012-07-12 07:21:12 +0000 |
commit | 9a2cb4245118aa246da073e77187cad55d9406d6 (patch) | |
tree | 273d19e58bbf2cafc1a3937a44c8016a3fe5166e /clang/bindings/python/tests/cindex/test_cursor.py | |
parent | f7755df77678558e36059c347c9c466b83f29959 (diff) | |
download | bcm5719-llvm-9a2cb4245118aa246da073e77187cad55d9406d6.tar.gz bcm5719-llvm-9a2cb4245118aa246da073e77187cad55d9406d6.zip |
[clang.py] Implement Token API
llvm-svn: 160111
Diffstat (limited to 'clang/bindings/python/tests/cindex/test_cursor.py')
-rw-r--r-- | clang/bindings/python/tests/cindex/test_cursor.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/bindings/python/tests/cindex/test_cursor.py b/clang/bindings/python/tests/cindex/test_cursor.py index 979838b21c7..51695e20b0c 100644 --- a/clang/bindings/python/tests/cindex/test_cursor.py +++ b/clang/bindings/python/tests/cindex/test_cursor.py @@ -231,3 +231,13 @@ def test_result_type(): assert foo is not None t = foo.result_type assert t.kind == TypeKind.INT + +def test_get_tokens(): + """Ensure we can map cursors back to tokens.""" + tu = get_tu('int foo(int i);') + foo = get_cursor(tu, 'foo') + + tokens = list(foo.get_tokens()) + assert len(tokens) == 7 + assert tokens[0].spelling == 'int' + assert tokens[1].spelling == 'foo' |