diff options
author | Daniel Dunbar <daniel@zuster.org> | 2010-01-24 02:02:07 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2010-01-24 02:02:07 +0000 |
commit | 74716e5ebdd30caf6eac0ec68f2a91e1b3920a87 (patch) | |
tree | 6e6678c18e8274dbda0420accd1fd4d61383ada0 /clang/bindings/python/tests | |
parent | 8fd2d01118d8ae82f0b08e298806f245eb694b4b (diff) | |
download | bcm5719-llvm-74716e5ebdd30caf6eac0ec68f2a91e1b3920a87.tar.gz bcm5719-llvm-74716e5ebdd30caf6eac0ec68f2a91e1b3920a87.zip |
Initial checkin of CIndex Python bindings, by Andrew Sutton!
- Some tweaks by me for API changes, Darwin, and x86_64 support. Still needs
substantial updating to match recent CIndex API changes.
llvm-svn: 94349
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 |