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 AccessSpecifier
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 TestAccessSpecifiers(unittest
.TestCase
):
18 def test_access_specifiers(self
):
19 """Ensure that C++ access specifiers are available on cursors"""
25 void public_member_function();
27 void protected_member_function();
29 void private_member_function();
35 test_class
= get_cursor(tu
, "test_class")
36 self
.assertEqual(test_class
.access_specifier
, AccessSpecifier
.INVALID
)
38 public
= get_cursor(tu
.cursor
, "public_member_function")
39 self
.assertEqual(public
.access_specifier
, AccessSpecifier
.PUBLIC
)
41 protected
= get_cursor(tu
.cursor
, "protected_member_function")
42 self
.assertEqual(protected
.access_specifier
, AccessSpecifier
.PROTECTED
)
44 private
= get_cursor(tu
.cursor
, "private_member_function")
45 self
.assertEqual(private
.access_specifier
, AccessSpecifier
.PRIVATE
)