summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2020-02-05 15:01:22 +0100
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2020-02-06 23:43:04 +0100
commitdbdb3cbc907fed4055adaa848dd5e36fb67b2263 (patch)
tree28f49b7519d3cfeaf93124023bbcbfb49748ca84
parenta2832c577f950a1673c5dea362b4c2e8087a64ea (diff)
Reduce scope of testlib selftest regular expressions
Change-Id: I2fd7a39684bde44d82c4d877086f606413d68520 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
-rw-r--r--tests/auto/testlib/selftests/tst_selftests.cpp6
1 files 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<LoggerSet> allLoggerSets() const;
QTemporaryDir tempDir;
- QRegularExpression durationRegExp;
- QRegularExpression teamcityLocRegExp;
};
struct BenchmarkResult
@@ -418,8 +416,6 @@ QList<LoggerSet> tst_Selftests::allLoggerSets() const
tst_Selftests::tst_Selftests()
: tempDir(QDir::tempPath() + "/tst_selftests.XXXXXX")
- , durationRegExp("<Duration msecs=\"[\\d\\.]+\"/>")
- , 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(" <Duration msecs="))
|| actualLine.startsWith(QLatin1String("<Duration msecs="))) {
+ static QRegularExpression durationRegExp("<Duration msecs=\"[\\d\\.]+\"/>");
QRegularExpressionMatch match = durationRegExp.match(actualLine);
if (match.hasMatch())
return true;