X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f9136b63ee00042fe1bf331f7e17f05ccc0021af..d73efa0b9c06aec0a4b39af3b7d1eab424068f83:/tests/log/logtest.cpp diff --git a/tests/log/logtest.cpp b/tests/log/logtest.cpp index 8c24835b43..5edbb84e30 100644 --- a/tests/log/logtest.cpp +++ b/tests/log/logtest.cpp @@ -3,7 +3,6 @@ // Purpose: wxLog unit test // Author: Vadim Zeitlin // Created: 2009-07-07 -// RCS-ID: $Id$ // Copyright: (c) 2009 Vadim Zeitlin /////////////////////////////////////////////////////////////////////////////// @@ -194,7 +193,7 @@ private: // register in the unnamed registry so that these tests are run by default CPPUNIT_TEST_SUITE_REGISTRATION( LogTestCase ); -// also include in it's own registry so that these tests can be run alone +// also include in its own registry so that these tests can be run alone CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( LogTestCase, "LogTestCase" ); void LogTestCase::setUp() @@ -342,17 +341,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__ }