From 49afb01e0a657a42221723ac29a69c1cfa9edc54 Mon Sep 17 00:00:00 2001 From: Andre Hartmann Date: Sun, 3 Feb 2019 21:00:11 +0100 Subject: 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 Reviewed-by: Orgad Shaneh --- src/plugins/qtsupport/qtoutputformatter.cpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'src/plugins/qtsupport/qtoutputformatter.cpp') diff --git a/src/plugins/qtsupport/qtoutputformatter.cpp b/src/plugins/qtsupport/qtoutputformatter.cpp index 8fba2797767..c5a4d7a427b 100644 --- a/src/plugins/qtsupport/qtoutputformatter.cpp +++ b/src/plugins/qtsupport/qtoutputformatter.cpp @@ -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" -- cgit v1.2.3