]> git.saurik.com Git - wxWidgets.git/blobdiff - tests/log/logtest.cpp
set up for OpenVMS richtext & regex and add more samples in compile cascade
[wxWidgets.git] / tests / log / logtest.cpp
index 644a18f89f189ca701090d67770e32e50b3fa90b..8c24835b43058c07d99190a820ced7ffa67b4dfb 100644 (file)
@@ -19,6 +19,7 @@
 
 #ifndef WX_PRECOMP
     #include "wx/log.h"
+    #include "wx/filefn.h"
 #endif // WX_PRECOMP
 
 #include "wx/scopeguard.h"
@@ -168,6 +169,7 @@ private:
         CPPUNIT_TEST( CompatLogger );
         CPPUNIT_TEST( CompatLogger2 );
 #endif // WXWIN_COMPATIBILITY_2_8
+        CPPUNIT_TEST( SysError );
     CPPUNIT_TEST_SUITE_END();
 
     void Functions();
@@ -180,6 +182,7 @@ private:
     void CompatLogger();
     void CompatLogger2();
 #endif // WXWIN_COMPATIBILITY_2_8
+    void SysError();
 
     TestLog *m_log;
     wxLog *m_logOld;
@@ -335,3 +338,21 @@ void LogTestCase::CompatLogger2()
 }
 
 #endif // WXWIN_COMPATIBILITY_2_8
+
+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") );
+
+    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") );
+}
+