AutoTest: Improve QRegularExpression usages

Use static const if possible to avoid re-initializations.

Change-Id: Ibee9e320dccb90cd928737b809db3b56369961ec
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Stenger
2023-07-04 08:31:37 +02:00
parent a85d7ef538
commit acad4b6b2e
8 changed files with 35 additions and 35 deletions

View File

@@ -146,7 +146,7 @@ QString QuickTestParser::quickTestName(const CPlusPlus::Document::Ptr &doc) cons
}
if (pchIncludes) {
const QRegularExpression regex("\\bQUICK_TEST_(MAIN|OPENGL_MAIN|MAIN_WITH_SETUP)");
static const QRegularExpression regex("\\bQUICK_TEST_(MAIN|OPENGL_MAIN|MAIN_WITH_SETUP)");
const QRegularExpressionMatch match = regex.match(QString::fromUtf8(fileContent));
if (match.hasMatch())
return match.captured(); // we do not care for the name, just return something non-empty