[Flang] remove whole-archive option for AIX linker (#76039)
[llvm-project.git] / clang / bindings / python / tests / cindex / test_comment.py
blob0727c6fa35d95a01671abe29e1b8d7a9cd6f14e2
1 import os
2 from clang.cindex import Config
4 if "CLANG_LIBRARY_PATH" in os.environ:
5 Config.set_library_path(os.environ["CLANG_LIBRARY_PATH"])
7 from clang.cindex import TranslationUnit
8 from tests.cindex.util import get_cursor
10 import unittest
13 class TestComment(unittest.TestCase):
14 def test_comment(self):
15 files = [
17 "fake.c",
18 """
19 /// Aaa.
20 int test1;
22 /// Bbb.
23 /// x
24 void test2(void);
26 void f() {
29 """,
32 # make a comment-aware TU
33 tu = TranslationUnit.from_source(
34 "fake.c",
35 ["-std=c99"],
36 unsaved_files=files,
37 options=TranslationUnit.PARSE_INCLUDE_BRIEF_COMMENTS_IN_CODE_COMPLETION,
39 test1 = get_cursor(tu, "test1")
40 self.assertIsNotNone(test1, "Could not find test1.")
41 self.assertTrue(test1.type.is_pod())
42 raw = test1.raw_comment
43 brief = test1.brief_comment
44 self.assertEqual(raw, """/// Aaa.""")
45 self.assertEqual(brief, """Aaa.""")
47 test2 = get_cursor(tu, "test2")
48 raw = test2.raw_comment
49 brief = test2.brief_comment
50 self.assertEqual(raw, """/// Bbb.\n/// x""")
51 self.assertEqual(brief, """Bbb. x""")
53 f = get_cursor(tu, "f")
54 raw = f.raw_comment
55 brief = f.brief_comment
56 self.assertIsNone(raw)
57 self.assertIsNone(brief)