summaryrefslogtreecommitdiffstats
path: root/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
commit1f8d7f94c7c61c7bb45ebb07e6ce5461bf2a80d5 (patch)
tree8598016aae3ffd4b52ee278e80202af2293299e7 /bindings/python/tests
parentfd9f23464bfd35314c87c4df410f3937d59eb96d (diff)
cindex/Python: Fix/simplify Index.parse() passing command line arguments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94394 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'bindings/python/tests')
-rw-r--r--bindings/python/tests/cindex/INPUTS/parse_arguments.c2
-rw-r--r--bindings/python/tests/cindex/test_translation_unit.py8
2 files changed, 10 insertions, 0 deletions
diff --git a/bindings/python/tests/cindex/INPUTS/parse_arguments.c b/bindings/python/tests/cindex/INPUTS/parse_arguments.c
new file mode 100644
index 0000000000..7196486c78
--- /dev/null
+++ b/bindings/python/tests/cindex/INPUTS/parse_arguments.c
@@ -0,0 +1,2 @@
+int DECL_ONE = 1;
+int DECL_TWO = 2;
diff --git a/bindings/python/tests/cindex/test_translation_unit.py b/bindings/python/tests/cindex/test_translation_unit.py
index e0b16f5345..9de82a6110 100644
--- a/bindings/python/tests/cindex/test_translation_unit.py
+++ b/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'