summaryrefslogtreecommitdiffstats
path: root/clang/bindings/python/tests
diff options
context:
space:
mode:
authorGregory Szorc <gregory.szorc@gmail.com>2012-06-11 11:11:48 +0000
committerGregory Szorc <gregory.szorc@gmail.com>2012-06-11 11:11:48 +0000
commit1162fa0a978c9eb86b702341d9dd85cd5d830ddf (patch)
treeb41742070de4f395b2cd517cde247dc8a8ba076c /clang/bindings/python/tests
parent96682025c74d1815c29c9c23937e99228026d05f (diff)
downloadbcm5719-llvm-1162fa0a978c9eb86b702341d9dd85cd5d830ddf.tar.gz
bcm5719-llvm-1162fa0a978c9eb86b702341d9dd85cd5d830ddf.zip
[clang.py] Implement SourceLocation.from_offset
llvm-svn: 158307
Diffstat (limited to 'clang/bindings/python/tests')
-rw-r--r--clang/bindings/python/tests/cindex/test_location.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/bindings/python/tests/cindex/test_location.py b/clang/bindings/python/tests/cindex/test_location.py
index 528676ef14b..9e9ef487af1 100644
--- a/clang/bindings/python/tests/cindex/test_location.py
+++ b/clang/bindings/python/tests/cindex/test_location.py
@@ -60,6 +60,15 @@ def test_location():
location3 = SourceLocation.from_position(tu, file, 1, 4)
assert location2 != location3
+ offset_location = SourceLocation.from_offset(tu, file, 5)
+ cursor = Cursor.from_location(tu, offset_location)
+ verified = False
+ for n in [n for n in tu.cursor.get_children() if n.spelling == 'one']:
+ assert n == cursor
+ verified = True
+
+ assert verified
+
def test_extent():
tu = get_tu(baseInput)
one = get_cursor(tu, 'one')
OpenPOWER on IntegriCloud