From 54e45f00ecfd8b251b78dccd1d0076a04b4f6815 Mon Sep 17 00:00:00 2001 From: Baidyanath Kundu Date: Fri, 16 Jun 2023 16:31:30 +0200 Subject: [PATCH] Add test for lookup of typedefs in struct --- unittests/CppInterOp/ScopeReflectionTest.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/unittests/CppInterOp/ScopeReflectionTest.cpp b/unittests/CppInterOp/ScopeReflectionTest.cpp index 6de4a68eb..8a574c68b 100644 --- a/unittests/CppInterOp/ScopeReflectionTest.cpp +++ b/unittests/CppInterOp/ScopeReflectionTest.cpp @@ -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::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) {