@@ -32,6 +32,10 @@ TEST_CASE_METHOD(CppAtributeTest, "Attribute specifier sequence")
3232
3333 [[xnet::HttpPost]] [[xnet::Route (" /register" )]] std::string CreateAccount (
3434 [[xnet::FromBody]] [[xnet::EnsureValid]] SignUpRequest request);
35+
36+ [[xnet::HttpGet, xnet::Route (" /entities" ), xnet::Route (" /entity" )]] std::string GetEntities ();
37+
38+ [[]] [[]] void UnannotatedHelper ();
3539 };
3640#endif
3741 auto testSnippet = getTestSnippetParseStream (__LINE__ - 2 );
@@ -72,7 +76,7 @@ TEST_CASE_METHOD(CppAtributeTest, "Attribute specifier sequence")
7276 CHECK ((*classAttrib1Arg) == cppast::CppStringLiteralExpr (" \" /plakmp\" " ));
7377
7478 const auto classMembers = GetAllOwnedEntities (*classDefn);
75- REQUIRE (classMembers.size () == 4 );
79+ REQUIRE (classMembers.size () == 6 );
7680
7781 const cppast::CppConstFunctionEPtr methodGetPlakMpPlayers = classMembers[1 ];
7882 REQUIRE (methodGetPlakMpPlayers);
@@ -95,4 +99,44 @@ TEST_CASE_METHOD(CppAtributeTest, "Attribute specifier sequence")
9599 cppast::CppConstStringLiteralExprEPtr methodAttrib1Arg = &(methodAttrib1->arg (0 ));
96100 REQUIRE (methodAttrib1Arg);
97101 CHECK ((*methodAttrib1Arg) == cppast::CppStringLiteralExpr (" \" /players\" " ));
102+
103+ const cppast::CppConstFunctionEPtr methodGetEntities = classMembers[4 ];
104+ REQUIRE (methodGetEntities);
105+ const auto * returnTypeGetEntities = methodGetEntities->returnType ();
106+ REQUIRE (returnTypeGetEntities);
107+
108+ const auto attribSeqGetEntities = GetAllAttributeSpecifiers (*returnTypeGetEntities);
109+ REQUIRE (attribSeqGetEntities.size () == 3 );
110+
111+ cppast::CppConstNameExprEPtr method2Attrib0 = attribSeqGetEntities.at (0 );
112+ REQUIRE (method2Attrib0);
113+ CHECK ((*method2Attrib0) == cppast::CppNameExpr (" xnet::HttpGet" ));
114+
115+ cppast::CppConstFunctionCallExprEPtr method2Attrib1 = attribSeqGetEntities.at (1 );
116+ REQUIRE (method2Attrib1);
117+ cppast::CppConstNameExprEPtr method2Attrib1Func = &(method2Attrib1->function ());
118+ REQUIRE (method2Attrib1Func);
119+ CHECK ((*method2Attrib1Func) == cppast::CppNameExpr (" xnet::Route" ));
120+ REQUIRE (method2Attrib1->numArgs () == 1 );
121+ cppast::CppConstStringLiteralExprEPtr method2Attrib1Arg = &(method2Attrib1->arg (0 ));
122+ REQUIRE (method2Attrib1Arg);
123+ CHECK ((*method2Attrib1Arg) == cppast::CppStringLiteralExpr (" \" /entities\" " ));
124+
125+ cppast::CppConstFunctionCallExprEPtr method2Attrib2 = attribSeqGetEntities.at (2 );
126+ REQUIRE (method2Attrib2);
127+ cppast::CppConstNameExprEPtr method2Attrib2Func = &(method2Attrib2->function ());
128+ REQUIRE (method2Attrib2Func);
129+ CHECK ((*method2Attrib2Func) == cppast::CppNameExpr (" xnet::Route" ));
130+ REQUIRE (method2Attrib2->numArgs () == 1 );
131+ cppast::CppConstStringLiteralExprEPtr method2Attrib2Arg = &(method2Attrib2->arg (0 ));
132+ REQUIRE (method2Attrib2Arg);
133+ CHECK ((*method2Attrib2Arg) == cppast::CppStringLiteralExpr (" \" /entity\" " ));
134+
135+ const cppast::CppConstFunctionEPtr methodUnannotatedHelper = classMembers[5 ];
136+ REQUIRE (methodUnannotatedHelper);
137+ const auto * returnTypeUnannotatedHelper = methodUnannotatedHelper->returnType ();
138+ REQUIRE (returnTypeUnannotatedHelper);
139+
140+ const auto attribSeqUnannotatedHelper = GetAllAttributeSpecifiers (*returnTypeUnannotatedHelper);
141+ REQUIRE (attribSeqUnannotatedHelper.size () == 0 );
98142}
0 commit comments