diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2013-10-07 16:38:40 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2013-10-07 16:38:40 +0000 |
commit | fe04fe0d41963735c8065eb2f547a3a08ef81810 (patch) | |
tree | fa20ecbe6b5899a3323da138b2aac57efe14e8dc /clang/bindings/python/tests | |
parent | b6ceeb9126187c29ee9b0b6912b9e6214a1e8919 (diff) | |
download | bcm5719-llvm-fe04fe0d41963735c8065eb2f547a3a08ef81810.tar.gz bcm5719-llvm-fe04fe0d41963735c8065eb2f547a3a08ef81810.zip |
[libclang] Add some tests by Loïc Jaquemet that I forgot to add earlier.
llvm-svn: 192108
Diffstat (limited to 'clang/bindings/python/tests')
-rw-r--r-- | clang/bindings/python/tests/cindex/test_comment.py | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/clang/bindings/python/tests/cindex/test_comment.py b/clang/bindings/python/tests/cindex/test_comment.py new file mode 100644 index 00000000000..d8f3129ac51 --- /dev/null +++ b/clang/bindings/python/tests/cindex/test_comment.py @@ -0,0 +1,40 @@ +from clang.cindex import TranslationUnit +from tests.cindex.util import get_cursor + +def test_comment(): + files = [('fake.c', """ +/// Aaa. +int test1; + +/// Bbb. +/// x +void test2(void); + +void f() { + +} +""")] + # make a comment-aware TU + tu = TranslationUnit.from_source('fake.c', ['-std=c99'], unsaved_files=files, + options=TranslationUnit.PARSE_INCLUDE_BRIEF_COMMENTS_IN_CODE_COMPLETION) + test1 = get_cursor(tu, 'test1') + assert test1 is not None, "Could not find test1." + assert test1.type.is_pod() + raw = test1.raw_comment + brief = test1.brief_comment + assert raw == """/// Aaa.""" + assert brief == """Aaa.""" + + test2 = get_cursor(tu, 'test2') + raw = test2.raw_comment + brief = test2.brief_comment + assert raw == """/// Bbb.\n/// x""" + assert brief == """Bbb. x""" + + f = get_cursor(tu, 'f') + raw = f.raw_comment + brief = f.brief_comment + assert raw is None + assert brief is None + + |