Review Request: Fix outputview filtering/classification when there are multiple keywords in a single line
Morten Volden
mvolden2 at gmail.com
Wed Dec 26 10:58:09 UTC 2012
> On Dec. 26, 2012, 10:45 a.m., Morten Volden wrote:
> > I guess I'll just go and revert the changes I did last night for this. Your fix is much more elegant - dang! ;-)
By the way. I don't know if you can use it for anything, but here is the extension i did of the unittest.
diff --git outputview/tests/filteringstrategytest.cpp outputview/tests/filteringstrategytest.cpp
index 8ff26b5..a146f7e 100644
--- outputview/tests/filteringstrategytest.cpp
+++ outputview/tests/filteringstrategytest.cpp
@@ -98,6 +98,34 @@ void FilteringStrategyTest::testCompilerFilterstrategy()
QVERIFY(item1.type == expectedAction);
}
+void FilteringStrategyTest::testCompilerFilterstrategyCorrectType_data()
+{
+ QTest::addColumn<QString>("line");
+ QTest::addColumn<FilteredItem::FilteredOutputItemType>("expectedError");
+ QTest::addColumn<FilteredItem::FilteredOutputItemType>("expectedAction");
+
+ QTest::newRow("warning-containing-error-word")
+ << "RingBuffer.cpp:64:6: warning: unused parameter ‘errorItem’ [-Wunused-parameter]"
+ << FilteredItem::WarningItem << FilteredItem::InvalidItem;
+ QTest::newRow("error-containing-info-word")
+ << "NodeSet.hpp:89:27: error: ‘Info’ was not declared in this scope"
+ << FilteredItem::ErrorItem << FilteredItem::InvalidItem;
+}
+
+void FilteringStrategyTest::testCompilerFilterstrategyCorrectType()
+{
+ QFETCH(QString, line);
+ QFETCH(FilteredItem::FilteredOutputItemType, expectedError);
+ QFETCH(FilteredItem::FilteredOutputItemType, expectedAction);
+ KUrl projecturl( PROJECTS_SOURCE_DIR"/onefileproject/" );
+ CompilerFilterStrategy testee(projecturl);
+ FilteredItem item1 = testee.errorInLine(line);
+ QVERIFY(item1.type == expectedError);
+ item1 = testee.actionInLine(line);
+ QVERIFY(item1.type == expectedAction);
+}
+
+
void FilteringStrategyTest::testScriptErrorFilterstrategy_data()
{
QTest::addColumn<QString>("line");
diff --git outputview/tests/filteringstrategytest.h outputview/tests/filteringstrategytest.h
index 0d9b943..508ac4f 100644
--- outputview/tests/filteringstrategytest.h
+++ outputview/tests/filteringstrategytest.h
@@ -31,6 +31,8 @@ private slots:
void testNoFilterstrategy();
void testCompilerFilterstrategy_data();
void testCompilerFilterstrategy();
+ void testCompilerFilterstrategyCorrectType_data();
+ void testCompilerFilterstrategyCorrectType();
void testCompilerFilterstrategyUrlFromAction_data();
void testCompilerFilterstrategyUrlFromAction();
void testScriptErrorFilterstrategy_data();
- Morten
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/107904/#review23989
-----------------------------------------------------------
On Dec. 24, 2012, 8:07 p.m., Ivan Shapovalov wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/107904/
> -----------------------------------------------------------
>
> (Updated Dec. 24, 2012, 8:07 p.m.)
>
>
> Review request for KDevelop and Morten Volden.
>
>
> Description
> -------
>
> Fix classification of error lines which look as
> "file.cpp:100:10: error: 'SomeSymbolWithWarningInItsName' was not declared in this scope".
>
> Here, we have an error pattern but also a "warning" keyword which actually is a part of symbol name. But existing code thinks that any appearance of "warning"/"info"/"note" in text is more important than the error pattern.
>
> Fix this by
> 1) checking for all patterns in a uniform manner (loop for "string<->classification" pairs, not just for strings), and
> 2) picking the pattern which happened most early (to the left) in string.
>
>
> Diffs
> -----
>
> outputview/outputfilteringstrategies.cpp 91361f1
> outputview/tests/testlinebuilderfunctions.h 3d264f7
>
> Diff: http://git.reviewboard.kde.org/r/107904/diff/
>
>
> Testing
> -------
>
> - Built kdevplatform+kdevelop with a couple of these lines, ensured they highlight as expected;
> - Improved existing unit-tests to catch the error in question.
>
>
> Thanks,
>
> Ivan Shapovalov
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20121226/8b2a6848/attachment-0001.html>
More information about the KDevelop-devel
mailing list