summaryrefslogtreecommitdiffstats
path: root/clang/bindings/python/tests
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-01-25 00:43:31 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-01-25 00:43:31 +0000
commit7baaee93e7af6f23e0838419c791dcfc61f18a81 (patch)
tree95f93f22bfdcda2aa52bda97b456e5758abef88f /clang/bindings/python/tests
parentd01592617f0c65300d64605686f54a30270ea297 (diff)
downloadbcm5719-llvm-7baaee93e7af6f23e0838419c791dcfc61f18a81.tar.gz
bcm5719-llvm-7baaee93e7af6f23e0838419c791dcfc61f18a81.zip
cindex/Python: Fix/simplify Index.parse() passing command line arguments.
llvm-svn: 94394
Diffstat (limited to 'clang/bindings/python/tests')
-rw-r--r--clang/bindings/python/tests/cindex/INPUTS/parse_arguments.c2
-rw-r--r--clang/bindings/python/tests/cindex/test_translation_unit.py8
2 files changed, 10 insertions, 0 deletions
diff --git a/clang/bindings/python/tests/cindex/INPUTS/parse_arguments.c b/clang/bindings/python/tests/cindex/INPUTS/parse_arguments.c
new file mode 100644
index 00000000000..7196486c78a
--- /dev/null
+++ b/clang/bindings/python/tests/cindex/INPUTS/parse_arguments.c
@@ -0,0 +1,2 @@
+int DECL_ONE = 1;
+int DECL_TWO = 2;
diff --git a/clang/bindings/python/tests/cindex/test_translation_unit.py b/clang/bindings/python/tests/cindex/test_translation_unit.py
index e0b16f5345f..9de82a6110c 100644
--- a/clang/bindings/python/tests/cindex/test_translation_unit.py
+++ b/clang/bindings/python/tests/cindex/test_translation_unit.py
@@ -16,3 +16,11 @@ def test_cursor():
c = tu.cursor
assert isinstance(c, Cursor)
assert c.kind is CursorKind.TRANSLATION_UNIT
+
+def test_parse_arguments():
+ path = os.path.join(kInputsDir, 'parse_arguments.c')
+ index = Index.create()
+ tu = index.parse(path, ['-DDECL_ONE=hello', '-DDECL_TWO=hi'])
+ spellings = [c.spelling for c in tu.cursor.get_children()]
+ assert spellings[-2] == 'hello'
+ assert spellings[-1] == 'hi'
OpenPOWER on IntegriCloud