@@ -22,6 +22,8 @@ using namespace clang;
22
22
TEST (FunctionReflectionTest, GetClassMethods) {
23
23
std::vector<Decl*> Decls;
24
24
std::string code = R"(
25
+ class A;
26
+
25
27
class A {
26
28
public:
27
29
int f1(int a, int b) { return a + b; }
@@ -70,7 +72,7 @@ TEST(FunctionReflectionTest, GetClassMethods) {
70
72
EXPECT_EQ (get_method_name (methods0[10 ]), " inline A::~A()" );
71
73
72
74
std::vector<Cpp::TCppFunction_t> methods1;
73
- Cpp::GetClassMethods (Decls[1 ], methods1);
75
+ Cpp::GetClassMethods (Decls[2 ], methods1);
74
76
EXPECT_EQ (methods0.size (), methods1.size ());
75
77
EXPECT_EQ (methods0[0 ], methods1[0 ]);
76
78
EXPECT_EQ (methods0[1 ], methods1[1 ]);
@@ -79,7 +81,7 @@ TEST(FunctionReflectionTest, GetClassMethods) {
79
81
EXPECT_EQ (methods0[4 ], methods1[4 ]);
80
82
81
83
std::vector<Cpp::TCppFunction_t> methods2;
82
- Cpp::GetClassMethods (Decls[2 ], methods2);
84
+ Cpp::GetClassMethods (Decls[3 ], methods2);
83
85
84
86
EXPECT_EQ (methods2.size (), 6 );
85
87
EXPECT_EQ (get_method_name (methods2[0 ]), " B::B(int n)" );
@@ -90,7 +92,7 @@ TEST(FunctionReflectionTest, GetClassMethods) {
90
92
EXPECT_EQ (get_method_name (methods2[5 ]), " inline B &B::operator=(B &&)" );
91
93
92
94
std::vector<Cpp::TCppFunction_t> methods3;
93
- Cpp::GetClassMethods (Decls[3 ], methods3);
95
+ Cpp::GetClassMethods (Decls[4 ], methods3);
94
96
95
97
EXPECT_EQ (methods3.size (), 9 );
96
98
EXPECT_EQ (get_method_name (methods3[0 ]), " B::B(int n)" );
@@ -104,7 +106,7 @@ TEST(FunctionReflectionTest, GetClassMethods) {
104
106
105
107
// Should not crash.
106
108
std::vector<Cpp::TCppFunction_t> methods4;
107
- Cpp::GetClassMethods (Decls[4 ], methods4);
109
+ Cpp::GetClassMethods (Decls[5 ], methods4);
108
110
EXPECT_EQ (methods4.size (), 0 );
109
111
110
112
std::vector<Cpp::TCppFunction_t> methods5;
0 commit comments