summaryrefslogtreecommitdiffstats
path: root/clang/bindings/python/tests
diff options
context:
space:
mode:
authorArnaud A. de Grandmaison <arnaud.adegm@gmail.com>2012-07-09 11:57:30 +0000
committerArnaud A. de Grandmaison <arnaud.adegm@gmail.com>2012-07-09 11:57:30 +0000
commit82dd00c5c3d0082b141fe55ecb919fa005c5748d (patch)
tree088e2a947ff75a1ed711eef1b8b1fa39d1ecc3ae /clang/bindings/python/tests
parent20f6fc6220d7b6ddef7103bac1c31a9a18e559b2 (diff)
downloadbcm5719-llvm-82dd00c5c3d0082b141fe55ecb919fa005c5748d.tar.gz
bcm5719-llvm-82dd00c5c3d0082b141fe55ecb919fa005c5748d.zip
[cindex.py] fix infinite iteration of compilation database CompileCommands
Patch by David Röthlisberger llvm-svn: 159926
Diffstat (limited to 'clang/bindings/python/tests')
-rw-r--r--clang/bindings/python/tests/cindex/test_cdb.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/bindings/python/tests/cindex/test_cdb.py b/clang/bindings/python/tests/cindex/test_cdb.py
index 38de4b1c14e..374f99bcbf6 100644
--- a/clang/bindings/python/tests/cindex/test_cdb.py
+++ b/clang/bindings/python/tests/cindex/test_cdb.py
@@ -61,6 +61,14 @@ def test_2_compilecommand():
for arg, exp in zip(cmds[i].arguments, expected[i]['line']):
assert arg.spelling == exp
+def test_compilecommand_iterator_stops():
+ """Check that iterator stops after the correct number of elements"""
+ cdb = CompilationDatabase.fromDirectory(kInputsDir)
+ count = 0
+ for cmd in cdb.getCompileCommands('/home/john.doe/MyProject/project2.cpp'):
+ count += 1
+ assert count <= 2
+
def test_compilationDB_references():
"""Ensure CompilationsCommands are independent of the database"""
cdb = CompilationDatabase.fromDirectory(kInputsDir)
OpenPOWER on IntegriCloud