Exclude tests relying on last error being set under MinGW.

The value of the last error seems to change somewhere between our code and
::GetLastError() call, probably in MinGW CRT, so exclude the tests relying on
it being preserved.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65740 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2010-10-03 17:15:24 +00:00
parent 9334ad1727
commit 3cfa70b71a

View File

@@ -342,17 +342,24 @@ void LogTestCase::CompatLogger2()
void LogTestCase::SysError() void LogTestCase::SysError()
{ {
wxString s; wxString s;
wxLogSysError("Success");
CPPUNIT_ASSERT( m_log->GetLog(wxLOG_Error).StartsWith("Success (", &s) );
CPPUNIT_ASSERT( s.StartsWith("error 0") );
wxLogSysError(17, "Error"); wxLogSysError(17, "Error");
CPPUNIT_ASSERT( m_log->GetLog(wxLOG_Error).StartsWith("Error (", &s) ); 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); wxOpen("no-such-file", 0, 0);
wxLogSysError("Not found"); wxLogSysError("Not found");
CPPUNIT_ASSERT( m_log->GetLog(wxLOG_Error).StartsWith("Not found (", &s) ); CPPUNIT_ASSERT( m_log->GetLog(wxLOG_Error).StartsWith("Not found (", &s) );
WX_ASSERT_MESSAGE( ("Error message is \"(%s\"", s), s.StartsWith("error 2") ); WX_ASSERT_MESSAGE( ("Error message is \"(%s\"", s), s.StartsWith("error 2") );
#endif // __MINGW32__
} }