QtOutputFormatter: Allow standalone file:// links

Either alone on a line, or with text before, or with
text afterwards, separated by colon, space, tab, or
brace as before.

Especially thought to capture cases like

 file:///home/user/main.cpp:157

on a single line, but accept that also as long as
the file link is separated by a word separator from
the sourrounding text.

Fixes: QTCREATORBUG-20406
Change-Id: I25bceb186818c9ea680741573a806f66395c3e16
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Andre Hartmann
2019-02-03 21:00:11 +01:00
committed by André Hartmann
parent 05bb8e9e30
commit 49afb01e0a

View File

@@ -53,7 +53,7 @@ public:
: qmlError("(" QT_QML_URL_REGEXP // url
":\\d+" // colon, line
"(?::\\d+)?)" // colon, column (optional)
"[: \t)]") // colon, space, tab or brace
"\\b") // word boundary
, qtError("Object::.*in (.*:\\d+)")
, qtAssert(QT_ASSERT_REGEXP)
, qtAssertX(QT_ASSERT_X_REGEXP)
@@ -364,6 +364,26 @@ void QtSupportPlugin::testQtOutputFormatter_data()
<< 0 << 19 << "file:///main.qml:20"
<< "/main.qml" << 20 << -1;
QTest::newRow("File link without further text")
<< "file:///home/user/main.cpp:157"
<< 0 << 30 << "file:///home/user/main.cpp:157"
<< "/home/user/main.cpp" << 157 << -1;
QTest::newRow("File link with text before")
<< "Text before: file:///home/user/main.cpp:157"
<< 13 << 43 << "file:///home/user/main.cpp:157"
<< "/home/user/main.cpp" << 157 << -1;
QTest::newRow("File link with text afterwards")
<< "file:///home/user/main.cpp:157: Text afterwards"
<< 0 << 30 << "file:///home/user/main.cpp:157"
<< "/home/user/main.cpp" << 157 << -1;
QTest::newRow("File link with text before and afterwards")
<< "Text before file:///home/user/main.cpp:157 and text afterwards"
<< 12 << 42 << "file:///home/user/main.cpp:157"
<< "/home/user/main.cpp" << 157 << -1;
QTest::newRow("Unix file link with timestamp")
<< "file:///home/user/main.cpp:157 2018-03-21 10:54:45.706"
<< 0 << 30 << "file:///home/user/main.cpp:157"