From dbdb3cbc907fed4055adaa848dd5e36fb67b2263 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 5 Feb 2020 15:01:22 +0100 Subject: [PATCH] Reduce scope of testlib selftest regular expressions Change-Id: I2fd7a39684bde44d82c4d877086f606413d68520 Reviewed-by: Edward Welbourne Reviewed-by: Simon Hausmann --- tests/auto/testlib/selftests/tst_selftests.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/auto/testlib/selftests/tst_selftests.cpp b/tests/auto/testlib/selftests/tst_selftests.cpp index 6e4a7896f6..5c50fc6548 100644 --- a/tests/auto/testlib/selftests/tst_selftests.cpp +++ b/tests/auto/testlib/selftests/tst_selftests.cpp @@ -76,8 +76,6 @@ private: QList allLoggerSets() const; QTemporaryDir tempDir; - QRegularExpression durationRegExp; - QRegularExpression teamcityLocRegExp; }; struct BenchmarkResult @@ -418,8 +416,6 @@ QList tst_Selftests::allLoggerSets() const tst_Selftests::tst_Selftests() : tempDir(QDir::tempPath() + "/tst_selftests.XXXXXX") - , durationRegExp("") - , teamcityLocRegExp("\\|\\[Loc: .*\\(\\d*\\)\\|\\]") {} void tst_Selftests::initTestCase() @@ -881,6 +877,7 @@ bool tst_Selftests::compareOutput(const QString &logger, const QString &subdir, // Special handling for ignoring _FILE_ and _LINE_ if logger is teamcity if (logger.endsWith(QLatin1String("teamcity"))) { + static QRegularExpression teamcityLocRegExp("\\|\\[Loc: .*\\(\\d*\\)\\|\\]"); actualLine.replace(teamcityLocRegExp, teamCityLocation()); expectedLine.replace(teamcityLocRegExp, teamCityLocation()); } @@ -951,6 +948,7 @@ bool tst_Selftests::compareLine(const QString &logger, const QString &subdir, if (actualLine.startsWith(QLatin1String(" "); QRegularExpressionMatch match = durationRegExp.match(actualLine); if (match.hasMatch()) return true;