forked from qt-creator/qt-creator
QtSupport: De-duplicate test failure pattern
The pattern needed to be changed to create a single capuring group that is used in QtOutputFormatter::matchLine() and in QtTestOutputReader::processPlainTextOutput(). Also, trailing characters (except whitespaces like carriage return on Windows) are now forbidden. Change-Id: I5c6260276e0c2954b917daa12c6882c99f135fa0 Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
committed by
André Hartmann
parent
fb4d8b5a01
commit
9a0ef8ac64
@@ -33,8 +33,8 @@
|
||||
#define QT_QML_URL_REGEXP "(?:file|qrc):(?://)?/.+?"
|
||||
#define QT_ASSERT_REGEXP "ASSERT: .* in file (.+, line \\d+)"
|
||||
#define QT_ASSERT_X_REGEXP "ASSERT failure in .*: \".*\", file (.+, line \\d+)"
|
||||
#define QT_TEST_FAIL_UNIX_REGEXP "^ Loc: \\[(.*)\\]$"
|
||||
#define QT_TEST_FAIL_WIN_REGEXP "^(.*\\(\\d+\\)) : failure location\\s*$"
|
||||
#define QT_TEST_FAIL_UNIX_REGEXP "^ Loc: \\[((?<file>.+)\\((?<line>\\d+)\\))\\]$"
|
||||
#define QT_TEST_FAIL_WIN_REGEXP "^((?<file>.+)\\((?<line>\\d+)\\)) : failure location\\s*$"
|
||||
|
||||
namespace ProjectExplorer { class Project; }
|
||||
|
||||
|
@@ -25,6 +25,8 @@
|
||||
|
||||
#include "qttestparser.h"
|
||||
|
||||
#include "qtoutputformatter.h"
|
||||
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <utils/qtcassert.h>
|
||||
@@ -61,8 +63,8 @@ void QtTestParser::stdOutput(const QString &line)
|
||||
return;
|
||||
}
|
||||
static const QRegularExpression locationPattern(HostOsInfo::isWindowsHost()
|
||||
? QString("^(?<file>.+)\\((?<line>\\d+)\\) : failure location.*$")
|
||||
: QString("^ Loc: \\[(?<file>.+)\\((?<line>\\d+)\\)\\].*$"));
|
||||
? QString(QT_TEST_FAIL_WIN_REGEXP)
|
||||
: QString(QT_TEST_FAIL_UNIX_REGEXP));
|
||||
QTC_CHECK(locationPattern.isValid());
|
||||
const QRegularExpressionMatch match = locationPattern.match(theLine);
|
||||
if (match.hasMatch()) {
|
||||
|
Reference in New Issue
Block a user