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

Method rowsInserted

plugins/cmake/testing/ctestrunjob.cpp:188–236  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

186}
187
188void CTestRunJob::rowsInserted(const QModelIndex &parent, int startRow, int endRow)
189{
190 // This regular expression matches the name of the testcase (whatever between the last "::" and "(", indeed )
191 // For example, from:
192 // PASS : ExpTest::testExp(sum)
193 // matches "testExp"
194 static QRegExp caseRx(QStringLiteral("::([^:]*)\\("), Qt::CaseSensitive, QRegExp::RegExp2);
195 for (int row = startRow; row <= endRow; ++row)
196 {
197 QString line = m_outputModel->data(m_outputModel->index(row, 0, parent), Qt::DisplayRole).toString();
198
199 QString testCase;
200 if (caseRx.indexIn(line) >= 0) {
201 testCase = caseRx.cap(1);
202 }
203
204 TestResult::TestCaseResult prevResult = m_caseResults.value(testCase, TestResult::NotRun);
205 if (prevResult == TestResult::Passed || prevResult == TestResult::NotRun)
206 {
207 TestResult::TestCaseResult result = TestResult::NotRun;
208 const bool expectFail = m_suite->properties().value(QStringLiteral("WILL_FAIL"), QStringLiteral("FALSE")) == QLatin1String("TRUE");
209 if (line.startsWith(QLatin1String("PASS :")))
210 {
211 result = expectFail ? TestResult::UnexpectedPass : TestResult::Passed;
212 }
213 else if (line.startsWith(QLatin1String("FAIL! :")))
214 {
215 result = expectFail ? TestResult::ExpectedFail : TestResult::Failed;
216 }
217 else if (line.startsWith(QLatin1String("XFAIL :")))
218 {
219 result = TestResult::ExpectedFail;
220 }
221 else if (line.startsWith(QLatin1String("XPASS :")))
222 {
223 result = TestResult::UnexpectedPass;
224 }
225 else if (line.startsWith(QLatin1String("SKIP :")))
226 {
227 result = TestResult::Skipped;
228 }
229
230 if (result != TestResult::NotRun)
231 {
232 m_caseResults[testCase] = result;
233 }
234 }
235 }
236}
237
238#include "moc_ctestrunjob.cpp"

Callers

nothing calls this directly

Calls 5

toStringMethod · 0.45
dataMethod · 0.45
indexMethod · 0.45
valueMethod · 0.45
propertiesMethod · 0.45

Tested by

no test coverage detected