Skip to content

Commit 54e45f0

Browse files
sudo-pandavgvassilev
authored andcommitted
Add test for lookup of typedefs in struct
1 parent c71069f commit 54e45f0

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
@@ -468,6 +468,24 @@ TEST(ScopeReflectionTest, GetNamed) {
468468
EXPECT_EQ(Cpp::GetQualifiedName(std_ns), "std");
469469
EXPECT_EQ(Cpp::GetQualifiedName(std_string_class), "std::string");
470470
EXPECT_EQ(Cpp::GetQualifiedName(std_string_npos_var), "std::basic_string<char>::npos");
471+
472+
Interp->declare(R"(
473+
struct S {
474+
typedef int Val;
475+
};
476+
477+
struct S1 : public S {
478+
/* empty */
479+
};
480+
)");
481+
Cpp::TCppScope_t strt_S = Cpp::GetNamed("S", nullptr);
482+
Cpp::TCppScope_t strt_S_Val = Cpp::GetNamed("Val", strt_S);
483+
Cpp::TCppScope_t strt_S1 = Cpp::GetNamed("S1", nullptr);
484+
Cpp::TCppScope_t strt_S1_Val = Cpp::GetNamed("Val", strt_S1);
485+
EXPECT_EQ(Cpp::GetQualifiedName(strt_S), "S");
486+
EXPECT_EQ(Cpp::GetQualifiedName(strt_S_Val), "S::Val");
487+
EXPECT_EQ(Cpp::GetQualifiedName(strt_S1), "S1");
488+
EXPECT_EQ(Cpp::GetQualifiedName(strt_S1_Val), "S1::Val");
471489
}
472490

473491
TEST(ScopeReflectionTest, GetParentScope) {

0 commit comments

Comments
 (0)