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 LinkageKind
8 from clang
.cindex
import Cursor
9 from clang
.cindex
import TranslationUnit
11 from .util
import get_cursor
12 from .util
import get_tu
17 class TestLinkage(unittest
.TestCase
):
18 def test_linkage(self
):
19 """Ensure that linkage specifers are available on cursors"""
23 void foo() { int no_linkage; }
25 namespace { struct unique_external_type {} }
26 unique_external_type unique_external;
32 no_linkage
= get_cursor(tu
.cursor
, "no_linkage")
33 self
.assertEqual(no_linkage
.linkage
, LinkageKind
.NO_LINKAGE
)
35 internal
= get_cursor(tu
.cursor
, "internal")
36 self
.assertEqual(internal
.linkage
, LinkageKind
.INTERNAL
)
38 unique_external
= get_cursor(tu
.cursor
, "unique_external")
39 self
.assertEqual(unique_external
.linkage
, LinkageKind
.UNIQUE_EXTERNAL
)
41 external
= get_cursor(tu
.cursor
, "external")
42 self
.assertEqual(external
.linkage
, LinkageKind
.EXTERNAL
)