File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed
clang/bindings/python/tests/cindex Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -72,23 +72,31 @@ def test_all_variants(self):
72
72
python_enum = cenum_to_pythonenum .get (cursor .type .spelling )
73
73
if cursor .kind == CursorKind .ENUM_CONSTANT_DECL :
74
74
if python_enum not in enum_variant_map :
75
- enum_variant_map [python_enum ] = []
76
- enum_variant_map [python_enum ]. append ( cursor .enum_value )
75
+ enum_variant_map [python_enum ] = dict ()
76
+ enum_variant_map [python_enum ][ cursor .enum_value ] = cursor . spelling
77
77
78
78
for enum in self .enums :
79
79
with self .subTest (enum ):
80
80
python_kinds = set ([kind .value for kind in enum ])
81
+ num_to_c_kind = enum_variant_map [enum ]
82
+ c_kinds = set (num_to_c_kind .keys ())
81
83
# Defined in Index.h but not in cindex.py
82
84
missing_python_kinds = c_kinds - python_kinds
85
+ missing_names = set (
86
+ [num_to_c_kind [kind ] for kind in missing_python_kinds ]
87
+ )
83
88
self .assertEqual (
84
- missing_python_kinds ,
89
+ missing_names ,
85
90
set (),
86
91
f"Please ensure these are defined in { enum } in cindex.py." ,
87
92
)
88
93
# Defined in cindex.py but not in Index.h
89
94
superfluous_python_kinds = python_kinds - c_kinds
95
+ missing_names = set (
96
+ [enum .from_id (kind ) for kind in superfluous_python_kinds ]
97
+ )
90
98
self .assertEqual (
91
- superfluous_python_kinds ,
99
+ missing_names ,
92
100
set (),
93
101
f"Please ensure that all { enum } kinds defined in cindex.py have an equivalent in Index.h" ,
94
102
)
You can’t perform that action at this time.
0 commit comments