diff options
author | Daniel Dunbar <daniel@zuster.org> | 2010-01-25 00:44:11 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2010-01-25 00:44:11 +0000 |
commit | 9ad194dc180100b343a61da95204747b5cc6299c (patch) | |
tree | 16c87a93a499dc51521a50fc787d8688229745a0 /clang/bindings/python/tests | |
parent | fcf2d428e4a4e4930dbef8eb55f89528eaa84af8 (diff) | |
download | bcm5719-llvm-9ad194dc180100b343a61da95204747b5cc6299c.tar.gz bcm5719-llvm-9ad194dc180100b343a61da95204747b5cc6299c.zip |
cindex/Python: Implement support for unsaved/remapped files.
llvm-svn: 94396
Diffstat (limited to 'clang/bindings/python/tests')
-rw-r--r-- | clang/bindings/python/tests/cindex/test_translation_unit.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/clang/bindings/python/tests/cindex/test_translation_unit.py b/clang/bindings/python/tests/cindex/test_translation_unit.py index 9de82a6110c..9cf7aba3bbf 100644 --- a/clang/bindings/python/tests/cindex/test_translation_unit.py +++ b/clang/bindings/python/tests/cindex/test_translation_unit.py @@ -24,3 +24,20 @@ def test_parse_arguments(): spellings = [c.spelling for c in tu.cursor.get_children()] assert spellings[-2] == 'hello' assert spellings[-1] == 'hi' + +def test_unsaved_files(): + index = Index.create() + # FIXME: Why can't we just use "fake.h" here (instead of /tmp/fake.h)? + tu = index.parse('fake.c', unsaved_files = [ + ('fake.c', """ +#include "/tmp/fake.h" +int x; +int SOME_DEFINE; +"""), + ('/tmp/fake.h', """ +#define SOME_DEFINE y +""") + ]) + spellings = [c.spelling for c in tu.cursor.get_children()] + assert spellings[-2] == 'x' + assert spellings[-1] == 'y' |