Improve reporting test failures due to assert failures

Show the condition which failed for wxASSERT() (as opposed to
wxASSERT_MSG()), as otherwise the error message didn't show any
information at all, making diagnosing the problem impossible.

Also show the assert location, as this can be useful too and there
doesn't seem to be any reason not to do it.
This commit is contained in:
Vadim Zeitlin 2020-12-12 18:13:25 +01:00
parent fcaccbf12c
commit 92e41a7477

View File

@ -171,7 +171,13 @@ static void TestAssertHandler(const wxString& file,
CATCH_TRANSLATE_EXCEPTION(TestAssertFailure& e)
{
return e.m_msg.ToStdString(wxConvUTF8);
wxString desc = e.m_msg;
if ( desc.empty() )
desc.Printf(wxASCII_STR("Condition \"%s\" failed"), e.m_cond);
desc += wxString::Format(wxASCII_STR(" in %s() at %s:%d"), e.m_func, e.m_file, e.m_line);
return desc.ToStdString(wxConvUTF8);
}
#endif // wxDEBUG_LEVEL