-
Notifications
You must be signed in to change notification settings - Fork 113
Fixes for CppParserTest #523
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,6 +13,8 @@ | |
| #include <model/cppnamespace-odb.hxx> | ||
| #include <model/cpprecord.h> | ||
| #include <model/cpprecord-odb.hxx> | ||
| #include <model/cpptypedef.h> | ||
| #include <model/cpptypedef-odb.hxx> | ||
| #include <model/cppvariable.h> | ||
| #include <model/cppvariable-odb.hxx> | ||
| #include <model/file.h> | ||
|
|
@@ -31,8 +33,11 @@ using QCppEnum = odb::query<model::CppEnum>; | |
| using QCppEnumConstant = odb::query<model::CppEnumConstant>; | ||
| using QCppNamespace = odb::query<model::CppNamespace>; | ||
| using QCppRecord = odb::query<model::CppRecord>; | ||
| using QCppTypedef = odb::query<model::CppTypedef>; | ||
| using QCppVariable = odb::query<model::CppVariable>; | ||
| using QFile = odb::query<model::File>; | ||
| using RCppEnum = odb::result<model::CppEnum>; | ||
| using RCppFunction = odb::result<model::CppFunction>; | ||
| using RCppAstNode = odb::result<model::CppAstNode>; | ||
|
|
||
| class CppParserTest : public ::testing::Test | ||
|
|
@@ -135,10 +140,12 @@ TEST_F(CppParserTest, FunctionDeclarationOnly) | |
| TEST_F(CppParserTest, FunctionWithMultipleDeclarations) | ||
| { | ||
| _transaction([&, this]() { | ||
| model::CppFunction callee = _db->query_value<model::CppFunction>( | ||
| RCppFunction callees = _db->query<model::CppFunction>( | ||
| QCppFunction::name == "multiFunction"); | ||
| EXPECT_FALSE(callees.empty()); | ||
|
|
||
| RCppAstNode multiFuncAstNode = _db->query<model::CppAstNode>( | ||
| QCppAstNode::entityHash == callee.entityHash); | ||
| QCppAstNode::entityHash == callees.begin()->entityHash); | ||
|
|
||
| int numDecl = 0, numDef = 0, numOther = 0; | ||
| for (const model::CppAstNode& n : multiFuncAstNode) | ||
|
|
@@ -296,10 +303,11 @@ TEST_F(CppParserTest, FunctionCall) | |
| TEST_F(CppParserTest, Typedef) | ||
| { | ||
| _transaction([&, this]() { | ||
| model::CppEnum integer = _db->query_value<model::CppEnum>( | ||
| QCppEnum::name == "Integer"); | ||
| model::CppTypedef integer = _db->query_value<model::CppTypedef>( | ||
| QCppTypedef::name == "Integer"); | ||
| RCppAstNode astNodes = _db->query<model::CppAstNode>( | ||
| QCppAstNode::entityHash == integer.entityHash); | ||
| EXPECT_FALSE(astNodes.empty()); | ||
|
|
||
| for (const model::CppAstNode& n : astNodes) | ||
| { | ||
|
|
@@ -449,11 +457,15 @@ TEST_F(CppParserTest, Record) | |
|
|
||
| TEST_F(CppParserTest, Enum) | ||
| { | ||
| _transaction([&, this] { | ||
| model::CppEnum enumeration = _db->query_value<model::CppEnum>( | ||
| _transaction([&, this] | ||
| { | ||
| RCppEnum enumerations = _db->query<model::CppEnum>( | ||
| QCppEnum::name == "Enumeration"); | ||
| EXPECT_FALSE(enumerations.empty()); | ||
|
|
||
| RCppAstNode astNodes = _db->query<model::CppAstNode>( | ||
| QCppAstNode::entityHash == enumeration.entityHash); | ||
| QCppAstNode::entityHash == enumerations.begin()->entityHash); | ||
| EXPECT_FALSE(astNodes.empty()); | ||
|
|
||
| for (const model::CppAstNode& n : astNodes) | ||
| { | ||
|
|
@@ -526,10 +538,15 @@ TEST_F(CppParserTest, Enum) | |
| break; | ||
| } | ||
| } | ||
| }); | ||
| } | ||
|
|
||
| model::CppFunction fieldFunction = _db->query_value<model::CppFunction>( | ||
| TEST_F(CppParserTest, Fields) | ||
| { | ||
| _transaction([&, this] { | ||
| model::CppVariable fieldFunction = _db->query_value<model::CppVariable>( | ||
| QCppFunction::name == "fieldFunction"); | ||
| astNodes = _db->query<model::CppAstNode>( | ||
| RCppAstNode astNodes = _db->query<model::CppAstNode>( | ||
|
Comment on lines
-530
to
+549
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the case where I was uncertain about my fix. This struct Derived : public MyClass
{
MyClass fieldVariable;
MyClass (*fieldFunction)(const MyClass&);
// etc...
};So it is a class member field, as a function pointer. It gets parsed into the
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| QCppAstNode::entityHash == fieldFunction.entityHash); | ||
|
|
||
| for (const model::CppAstNode& n : astNodes) | ||
|
|
||

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here
Integerwas not an enum, but a typedef in the parsed source code.