summaryrefslogtreecommitdiffstats
path: root/clang/bindings/python/tests
diff options
context:
space:
mode:
authorGuillaume Papin <guillaume.papin@epitech.eu>2016-03-07 18:44:42 +0000
committerGuillaume Papin <guillaume.papin@epitech.eu>2016-03-07 18:44:42 +0000
commit06eff5f2c8f9920d93ce485c7f41b598f0a99c1e (patch)
tree546ee3b6322788cf77370070d8274a9c811462a7 /clang/bindings/python/tests
parentbb3680bd8590b2dd817bbbb482badd6ebcbe6224 (diff)
downloadbcm5719-llvm-06eff5f2c8f9920d93ce485c7f41b598f0a99c1e.tar.gz
bcm5719-llvm-06eff5f2c8f9920d93ce485c7f41b598f0a99c1e.zip
python binding: expose compile command filename
Reviewers: compnerd, skalinichev Differential Revision: http://reviews.llvm.org/D17278 llvm-svn: 262845
Diffstat (limited to 'clang/bindings/python/tests')
-rw-r--r--clang/bindings/python/tests/cindex/test_cdb.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/clang/bindings/python/tests/cindex/test_cdb.py b/clang/bindings/python/tests/cindex/test_cdb.py
index e1f824f797f..35fe3e108a1 100644
--- a/clang/bindings/python/tests/cindex/test_cdb.py
+++ b/clang/bindings/python/tests/cindex/test_cdb.py
@@ -38,27 +38,34 @@ def test_all_compilecommand():
cmds = cdb.getAllCompileCommands()
assert len(cmds) == 3
expected = [
+ { 'wd': '/home/john.doe/MyProject',
+ 'file': '/home/john.doe/MyProject/project.cpp',
+ 'line': ['clang++', '-o', 'project.o', '-c',
+ '/home/john.doe/MyProject/project.cpp']},
{ 'wd': '/home/john.doe/MyProjectA',
+ 'file': '/home/john.doe/MyProject/project2.cpp',
'line': ['clang++', '-o', 'project2.o', '-c',
'/home/john.doe/MyProject/project2.cpp']},
{ 'wd': '/home/john.doe/MyProjectB',
+ 'file': '/home/john.doe/MyProject/project2.cpp',
'line': ['clang++', '-DFEATURE=1', '-o', 'project2-feature.o', '-c',
'/home/john.doe/MyProject/project2.cpp']},
- { 'wd': '/home/john.doe/MyProject',
- 'line': ['clang++', '-o', 'project.o', '-c',
- '/home/john.doe/MyProject/project.cpp']}
+
]
for i in range(len(cmds)):
assert cmds[i].directory == expected[i]['wd']
+ assert cmds[i].filename == expected[i]['file']
for arg, exp in zip(cmds[i].arguments, expected[i]['line']):
assert arg == exp
def test_1_compilecommand():
"""Check file with single compile command"""
cdb = CompilationDatabase.fromDirectory(kInputsDir)
- cmds = cdb.getCompileCommands('/home/john.doe/MyProject/project.cpp')
+ file = '/home/john.doe/MyProject/project.cpp'
+ cmds = cdb.getCompileCommands(file)
assert len(cmds) == 1
- assert cmds[0].directory == '/home/john.doe/MyProject'
+ assert cmds[0].directory == os.path.dirname(file)
+ assert cmds[0].filename == file
expected = [ 'clang++', '-o', 'project.o', '-c',
'/home/john.doe/MyProject/project.cpp']
for arg, exp in zip(cmds[0].arguments, expected):
OpenPOWER on IntegriCloud