diff options
Diffstat (limited to 'clang/bindings/python/tests')
-rw-r--r-- | clang/bindings/python/tests/__init__.py | 0 | ||||
-rw-r--r-- | clang/bindings/python/tests/cindex/INPUTS/hello.cpp | 6 | ||||
-rw-r--r-- | clang/bindings/python/tests/cindex/__init__.py | 0 | ||||
-rw-r--r-- | clang/bindings/python/tests/cindex/test_index.py | 15 | ||||
-rw-r--r-- | clang/bindings/python/tests/cindex/test_translation_unit.py | 10 |
5 files changed, 31 insertions, 0 deletions
diff --git a/clang/bindings/python/tests/__init__.py b/clang/bindings/python/tests/__init__.py new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/clang/bindings/python/tests/__init__.py diff --git a/clang/bindings/python/tests/cindex/INPUTS/hello.cpp b/clang/bindings/python/tests/cindex/INPUTS/hello.cpp new file mode 100644 index 00000000000..7ef086e56b2 --- /dev/null +++ b/clang/bindings/python/tests/cindex/INPUTS/hello.cpp @@ -0,0 +1,6 @@ +#include "stdio.h" + +int main(int argc, char* argv[]) { + printf("hello world\n"); + return 0; +} diff --git a/clang/bindings/python/tests/cindex/__init__.py b/clang/bindings/python/tests/cindex/__init__.py new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/clang/bindings/python/tests/cindex/__init__.py diff --git a/clang/bindings/python/tests/cindex/test_index.py b/clang/bindings/python/tests/cindex/test_index.py new file mode 100644 index 00000000000..dc173f04d21 --- /dev/null +++ b/clang/bindings/python/tests/cindex/test_index.py @@ -0,0 +1,15 @@ +from clang.cindex import * +import os + +kInputsDir = os.path.join(os.path.dirname(__file__), 'INPUTS') + +def test_create(): + index = Index.create() + +# FIXME: test Index.read + +def test_parse(): + index = Index.create() + assert isinstance(index, Index) + tu = index.parse(os.path.join(kInputsDir, 'hello.cpp')) + assert isinstance(tu, TranslationUnit) diff --git a/clang/bindings/python/tests/cindex/test_translation_unit.py b/clang/bindings/python/tests/cindex/test_translation_unit.py new file mode 100644 index 00000000000..e1012474606 --- /dev/null +++ b/clang/bindings/python/tests/cindex/test_translation_unit.py @@ -0,0 +1,10 @@ +from clang.cindex import * +import os + +kInputsDir = os.path.join(os.path.dirname(__file__), 'INPUTS') + +def test_spelling(): + path = os.path.join(kInputsDir, 'hello.cpp') + index = Index.create() + tu = index.parse(path) + assert str(tu.spelling) == path |