@@ -633,6 +633,35 @@ TEST(CallHierarchy, HierarchyOnVar) {
633
633
iFromRanges (Source.range (" Callee" )))));
634
634
}
635
635
636
+ TEST (CallHierarchy, HierarchyOnEnumConstant) {
637
+ // Tests that the call hierarchy works on enum constants.
638
+ Annotations Source (R"cpp(
639
+ enum class Coin { heads$Heads^ , tai$Tails^ls };
640
+ void caller() {
641
+ Coin::$CallerH[[heads]];
642
+ Coin::$CallerT[[tails]];
643
+ }
644
+ )cpp" );
645
+ TestTU TU = TestTU::withCode (Source.code ());
646
+ auto AST = TU.build ();
647
+ auto Index = TU.index ();
648
+
649
+ std::vector<CallHierarchyItem> Items =
650
+ prepareCallHierarchy (AST, Source.point (" Heads" ), testPath (TU.Filename ));
651
+ ASSERT_THAT (Items, ElementsAre (withName (" heads" )));
652
+ auto IncomingLevel1 = incomingCalls (Items[0 ], Index.get ());
653
+ ASSERT_THAT (IncomingLevel1,
654
+ ElementsAre (AllOf (from (withName (" caller" )),
655
+ iFromRanges (Source.range (" CallerH" )))));
656
+ Items =
657
+ prepareCallHierarchy (AST, Source.point (" Tails" ), testPath (TU.Filename ));
658
+ ASSERT_THAT (Items, ElementsAre (withName (" tails" )));
659
+ IncomingLevel1 = incomingCalls (Items[0 ], Index.get ());
660
+ ASSERT_THAT (IncomingLevel1,
661
+ ElementsAre (AllOf (from (withName (" caller" )),
662
+ iFromRanges (Source.range (" CallerT" )))));
663
+ }
664
+
636
665
TEST (CallHierarchy, CallInDifferentFileThanCaller) {
637
666
Annotations Header (R"cpp(
638
667
#define WALDO void caller() {
0 commit comments