MCPcopy Create free account
hub / github.com/KDE/kdevelop / findCaseDeclarations

Method findCaseDeclarations

plugins/cmake/testing/ctestsuite.cpp:46–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44}
45
46bool CTestSuite::findCaseDeclarations(const QVector<Declaration*> &classDeclarations)
47{
48 for (Declaration* decl : classDeclarations) {
49 qCDebug(CMAKE_TESTING) << "Found declaration" << decl->toString()
50 << decl->identifier().identifier().byteArray();
51
52 const auto* const function = dynamic_cast<ClassFunctionDeclaration*>(decl);
53 if (!function || !(function->accessPolicy() == Declaration::Private && function->isSlot())) {
54 continue;
55 }
56 QString name = function->qualifiedIdentifier().last().toString();
57 qCDebug(CMAKE_TESTING) << "Found private slot in test" << name;
58
59 if (name.endsWith(QLatin1String("_data"))) {
60 continue;
61 }
62
63 const auto functionType = function->type<FunctionType>();
64 if (!functionType || functionType->indexedArgumentsSize() > 0) {
65 // function declarations with arguments are not valid test functions
66 continue;
67 }
68 qCDebug(CMAKE_TESTING) << "Found test case function declaration" << function->identifier().toString();
69
70 if (name != QLatin1String("initTestCase") && name != QLatin1String("cleanupTestCase") &&
71 name != QLatin1String("init") && name != QLatin1String("cleanup"))
72 {
73 m_cases << name;
74 } else {
75 continue;
76 }
77
78 const auto* def = FunctionDefinition::definition(decl);
79 m_declarations[name] = def ? IndexedDeclaration(def) : IndexedDeclaration(function);
80 }
81 return !m_declarations.isEmpty();
82}
83
84void CTestSuite::loadDeclarations(const IndexedString& document, const KDevelop::ReferencedTopDUContext& ref)
85{

Callers

nothing calls this directly

Calls 11

byteArrayMethod · 0.80
accessPolicyMethod · 0.80
isSlotMethod · 0.80
endsWithMethod · 0.80
indexedArgumentsSizeMethod · 0.80
IndexedDeclarationClass · 0.50
toStringMethod · 0.45
identifierMethod · 0.45
lastMethod · 0.45
qualifiedIdentifierMethod · 0.45
isEmptyMethod · 0.45

Tested by

no test coverage detected