Skip to content

Commit 6846fb1

Browse files
committed
Add test for lookup of typedefs in struct
1 parent a5a21bf commit 6846fb1

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

unittests/CppInterOp/ScopeReflectionTest.cpp

+18
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,24 @@ TEST(ScopeReflectionTest, GetNamed) {
444444
EXPECT_EQ(Cpp::GetQualifiedName(std_ns), "std");
445445
EXPECT_EQ(Cpp::GetQualifiedName(std_string_class), "std::string");
446446
EXPECT_EQ(Cpp::GetQualifiedName(std_string_npos_var), "std::basic_string<char>::npos");
447+
448+
Interp->declare(R"(
449+
struct S {
450+
typedef int Val;
451+
};
452+
453+
struct S1 : public S {
454+
/* empty */
455+
};
456+
)");
457+
Cpp::TCppScope_t strt_S = Cpp::GetNamed("S", nullptr);
458+
Cpp::TCppScope_t strt_S_Val = Cpp::GetNamed("Val", strt_S);
459+
Cpp::TCppScope_t strt_S1 = Cpp::GetNamed("S1", nullptr);
460+
Cpp::TCppScope_t strt_S1_Val = Cpp::GetNamed("Val", strt_S1);
461+
EXPECT_EQ(Cpp::GetQualifiedName(strt_S), "S");
462+
EXPECT_EQ(Cpp::GetQualifiedName(strt_S_Val), "S::Val");
463+
EXPECT_EQ(Cpp::GetQualifiedName(strt_S1), "S1");
464+
EXPECT_EQ(Cpp::GetQualifiedName(strt_S1_Val), "S1::Val");
447465
}
448466

449467
TEST(ScopeReflectionTest, GetParentScope) {

0 commit comments

Comments
 (0)