summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2018-10-17 19:32:54 +0200
committerEdward Welbourne <edward.welbourne@qt.io>2018-11-01 15:05:59 +0000
commit30101884a6f3ab2f3d4d11426373eca3fca10652 (patch)
tree2576c96031b72937cb265dd9041b60c1dd0b0e68 /tests/auto
parent779a73762de6addb2a2e3fee5b98d00d64101b92 (diff)
Simplify tst_Selftests::compareLine by handling the trivial case first
If the two lines have identical texts, the comparison returns true. So don't complicate various other conditions on the way there with filtering out that case; deal with it first so they don't need to. Change-Id: Iebd230704ce5f53d12d5afa64aab30f83bb9d407 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/testlib/selftests/tst_selftests.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/auto/testlib/selftests/tst_selftests.cpp b/tests/auto/testlib/selftests/tst_selftests.cpp
index c5f847562e..2d3cfaf176 100644
--- a/tests/auto/testlib/selftests/tst_selftests.cpp
+++ b/tests/auto/testlib/selftests/tst_selftests.cpp
@@ -893,16 +893,19 @@ bool tst_Selftests::compareLine(const QString &logger, const QString &subdir,
const QString &actualLine, const QString &expectedLine,
QString *errorMessage) const
{
- if (subdir == QLatin1String("assert") && actualLine.contains(QLatin1String("ASSERT: "))
- && expectedLine.contains(QLatin1String("ASSERT: ")) && actualLine != expectedLine) {
+ if (actualLine == expectedLine)
+ return true;
+
+ if (subdir == QLatin1String("assert")
+ && actualLine.contains(QLatin1String("ASSERT: "))
+ && expectedLine.contains(QLatin1String("ASSERT: "))) {
// Q_ASSERT uses __FILE__, the exact contents of which are
// undefined. If have we something that looks like a Q_ASSERT and we
// were expecting to see a Q_ASSERT, we'll skip the line.
return true;
}
- if (expectedLine.startsWith(QLatin1String("FAIL! : tst_Exception::throwException() Caught unhandled exce"))
- && actualLine != expectedLine) {
+ if (expectedLine.startsWith(QLatin1String("FAIL! : tst_Exception::throwException() Caught unhandled exce"))) {
// On some platforms we compile without RTTI, and as a result we never throw an exception
if (actualLine.simplified() != QLatin1String("tst_Exception::throwException()")) {
*errorMessage = QString::fromLatin1("'%1' != 'tst_Exception::throwException()'").arg(actualLine);
@@ -941,9 +944,6 @@ bool tst_Selftests::compareLine(const QString &logger, const QString &subdir,
if (actualLine.startsWith(QLatin1String("Totals:")) && expectedLine.startsWith(QLatin1String("Totals:")))
return true;
- if (actualLine == expectedLine)
- return true;
-
*errorMessage = msgMismatch(actualLine, expectedLine);
return false;
}