Skip to content

Commit

Permalink
Add test for lookup of typedefs in struct
Browse files Browse the repository at this point in the history
  • Loading branch information
sudo-panda authored and vgvassilev committed Dec 17, 2024
1 parent c71069f commit 54e45f0
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions unittests/CppInterOp/ScopeReflectionTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,24 @@ TEST(ScopeReflectionTest, GetNamed) {
EXPECT_EQ(Cpp::GetQualifiedName(std_ns), "std");
EXPECT_EQ(Cpp::GetQualifiedName(std_string_class), "std::string");
EXPECT_EQ(Cpp::GetQualifiedName(std_string_npos_var), "std::basic_string<char>::npos");

Interp->declare(R"(
struct S {
typedef int Val;
};
struct S1 : public S {
/* empty */
};
)");
Cpp::TCppScope_t strt_S = Cpp::GetNamed("S", nullptr);
Cpp::TCppScope_t strt_S_Val = Cpp::GetNamed("Val", strt_S);
Cpp::TCppScope_t strt_S1 = Cpp::GetNamed("S1", nullptr);
Cpp::TCppScope_t strt_S1_Val = Cpp::GetNamed("Val", strt_S1);
EXPECT_EQ(Cpp::GetQualifiedName(strt_S), "S");
EXPECT_EQ(Cpp::GetQualifiedName(strt_S_Val), "S::Val");
EXPECT_EQ(Cpp::GetQualifiedName(strt_S1), "S1");
EXPECT_EQ(Cpp::GetQualifiedName(strt_S1_Val), "S1::Val");
}

TEST(ScopeReflectionTest, GetParentScope) {
Expand Down

0 comments on commit 54e45f0

Please sign in to comment.