Debian Codegraph @

clang/bindings/python/tests/cindex/test_index.py

raw
1 import os
2 from clang.cindex import Config
3
4 if "CLANG_LIBRARY_PATH" in os.environ:
5 Config.set_library_path(os.environ["CLANG_LIBRARY_PATH"])
6
7 from clang.cindex import *
8 import os
9 import unittest
10
11
12 kInputsDir = os.path.join(os.path.dirname(__file__), "INPUTS")
13
14
15 class TestIndex(unittest.TestCase):
16 def test_create(self):
17 index = Index.create()
18
19 # FIXME: test Index.read
20
21 def test_parse(self):
22 index = Index.create()
23 self.assertIsInstance(index, Index)
24 tu = index.parse(os.path.join(kInputsDir, "hello.cpp"))
25 self.assertIsInstance(tu, TranslationUnit)
26 tu = index.parse(None, ["-c", os.path.join(kInputsDir, "hello.cpp")])
27 self.assertIsInstance(tu, TranslationUnit)