Skip to content

Commit d85581f

Browse files
sudo-pandavgvassilev
authored andcommitted
Add test for lookup of typedefs in struct
1 parent 827d2df commit d85581f

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

unittests/CppInterOp/ScopeReflectionTest.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,24 @@ TEST(ScopeReflectionTest, GetNamed) {
467467
EXPECT_EQ(Cpp::GetQualifiedName(std_ns), "std");
468468
EXPECT_EQ(Cpp::GetQualifiedName(std_string_class), "std::string");
469469
EXPECT_EQ(Cpp::GetQualifiedName(std_string_npos_var), "std::basic_string<char>::npos");
470+
471+
Interp->declare(R"(
472+
struct S {
473+
typedef int Val;
474+
};
475+
476+
struct S1 : public S {
477+
/* empty */
478+
};
479+
)");
480+
Cpp::TCppScope_t strt_S = Cpp::GetNamed("S", nullptr);
481+
Cpp::TCppScope_t strt_S_Val = Cpp::GetNamed("Val", strt_S);
482+
Cpp::TCppScope_t strt_S1 = Cpp::GetNamed("S1", nullptr);
483+
Cpp::TCppScope_t strt_S1_Val = Cpp::GetNamed("Val", strt_S1);
484+
EXPECT_EQ(Cpp::GetQualifiedName(strt_S), "S");
485+
EXPECT_EQ(Cpp::GetQualifiedName(strt_S_Val), "S::Val");
486+
EXPECT_EQ(Cpp::GetQualifiedName(strt_S1), "S1");
487+
EXPECT_EQ(Cpp::GetQualifiedName(strt_S1_Val), "S1::Val");
470488
}
471489

472490
TEST(ScopeReflectionTest, GetParentScope) {

0 commit comments

Comments
 (0)