summaryrefslogtreecommitdiffstats
path: root/clang/bindings/python/tests
diff options
context:
space:
mode:
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