3 from clang
.cindex
import Config
, Index
, TranslationUnit
5 if "CLANG_LIBRARY_PATH" in os
.environ
:
6 Config
.set_library_path(os
.environ
["CLANG_LIBRARY_PATH"])
10 kInputsDir
= os
.path
.join(os
.path
.dirname(__file__
), "INPUTS")
13 class TestIndex(unittest
.TestCase
):
14 def test_create(self
):
17 # FIXME: test Index.read
20 index
= Index
.create()
21 self
.assertIsInstance(index
, Index
)
22 tu
= index
.parse(os
.path
.join(kInputsDir
, "hello.cpp"))
23 self
.assertIsInstance(tu
, TranslationUnit
)
24 tu
= index
.parse(None, ["-c", os
.path
.join(kInputsDir
, "hello.cpp")])
25 self
.assertIsInstance(tu
, TranslationUnit
)