X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b804f9924d38b16d5cd72ba6c55195f9b1cc5896..6853f5fbf9af00af3d9954e5bf94e9c18238b683:/tests/log/logtest.cpp diff --git a/tests/log/logtest.cpp b/tests/log/logtest.cpp index 7d859c7d00..5108a5fb3d 100644 --- a/tests/log/logtest.cpp +++ b/tests/log/logtest.cpp @@ -19,6 +19,7 @@ #ifndef WX_PRECOMP #include "wx/log.h" + #include "wx/filefn.h" #endif // WX_PRECOMP #include "wx/scopeguard.h" @@ -341,17 +342,24 @@ void LogTestCase::CompatLogger2() void LogTestCase::SysError() { wxString s; - wxLogSysError("Success"); - CPPUNIT_ASSERT( m_log->GetLog(wxLOG_Error).StartsWith("Success (", &s) ); - CPPUNIT_ASSERT( s.StartsWith("error 0") ); wxLogSysError(17, "Error"); CPPUNIT_ASSERT( m_log->GetLog(wxLOG_Error).StartsWith("Error (", &s) ); - CPPUNIT_ASSERT( s.StartsWith("error 17") ); + WX_ASSERT_MESSAGE( ("Error message is \"(%s\"", s), s.StartsWith("error 17") ); + + // The last error code seems to be set somewhere in MinGW CRT as its value + // is just not what we expect (ERROR_INVALID_PARAMETER instead of 0 and 0 + // instead of ERROR_FILE_NOT_FOUND) so exclude the tests which rely on last + // error being preserved for this compiler. +#ifndef __MINGW32__ + wxLogSysError("Success"); + CPPUNIT_ASSERT( m_log->GetLog(wxLOG_Error).StartsWith("Success (", &s) ); + WX_ASSERT_MESSAGE( ("Error message is \"(%s\"", s), s.StartsWith("error 0") ); wxOpen("no-such-file", 0, 0); wxLogSysError("Not found"); CPPUNIT_ASSERT( m_log->GetLog(wxLOG_Error).StartsWith("Not found (", &s) ); WX_ASSERT_MESSAGE( ("Error message is \"(%s\"", s), s.StartsWith("error 2") ); +#endif // __MINGW32__ }