Debian Codegraph @

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

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