outputview: catch more possible assert messages

Be less strict about the default assert message, so it can match also custom
assert messages. Also add an expression that matches the assert_perror() output
of glibc.
parent dda833db
......@@ -395,8 +395,17 @@ FilteredItem NativeAppErrorFilterStrategy::errorInLine(const QString& line)
static const ErrorFormat NATIVE_APPLICATION_ERROR_FILTERS[] = {
// BEGIN: C++
// assert(false)
// a.out: test.cpp:5: int main(): Assertion `false' failed.
ErrorFormat(QStringLiteral("^.+: (.+):([1-9][0-9]*): .*: Assertion `.*' failed\\.$"), 1, 2, -1),
// this may also match custom assert message like this one from OSM2go:
// code at: /osm2go/tests/osm_edit.cpp:47: int main(): Assertion foo = bar failed: foo = 5, bar = 4
// If there is a technical reason not to do so: fine. But for the moment it's easy enough to catch it.
ErrorFormat(QStringLiteral("^.+: (.+):([1-9][0-9]*): .+: Assertion .+ failed"), 1, 2, -1),
// assert_perror(42)
// a.out: test.cpp:2009: void {anonymous}::test(): Unexpected error: Broken pipe.
ErrorFormat(QStringLiteral("^.+: (.+):([1-9][0-9]*): .+: Unexpected error: "), 1, 2, -1),
// END: C++
......
......@@ -263,6 +263,17 @@ void TestFilteringStrategy::testNativeAppErrorFilterStrategy_data()
<< "a.out: /foo/bar/test.cpp:5: int main(): Assertion `false' failed."
<< "/foo/bar/test.cpp"
<< 4 << 0 << FilteredItem::ErrorItem;
// same filter, may also may match on custom assert messages
QTest::newRow("custom-assert")
<< "code at: /osm2go/tests/osm_edit.cpp:47: int main(): Assertion foo = bar failed: foo = 5, bar = 4"
<< "/osm2go/tests/osm_edit.cpp"
<< 46 << 0 << FilteredItem::ErrorItem;
QTest::newRow("glibc assert_perror()")
<< "a.out: /foo/bar/test.cpp:2009: int void {anonymous}::main(): Unexpected error: Broken pipe."
<< "/foo/bar/test.cpp"
<< 2008 << 0 << FilteredItem::ErrorItem;
// END: C++
// BEGIN: Qt
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment