]> git.saurik.com Git - wxWidgets.git/commitdiff
add wxTempFile test
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 4 Nov 2006 18:25:08 +0000 (18:25 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 4 Nov 2006 18:25:08 +0000 (18:25 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43050 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

samples/console/console.cpp

index a151a12468b12153d868f69bf250b0bd51c37121..90548b244556dbccea560b9bdad53da1dfeef28b 100644 (file)
@@ -88,7 +88,7 @@
     #define TEST_WCHAR
     #define TEST_ZIP
 #else // #if TEST_ALL
-    #define TEST_CMDLINE
+    #define TEST_FILE
 #endif
 
 // some tests are interactive, define this to run them
@@ -720,6 +720,24 @@ static void TestFileCopy()
     wxPuts(wxEmptyString);
 }
 
+static void TestTempFile()
+{
+    wxPuts(_T("*** wxTempFile test ***"));
+
+    wxTempFile tmpFile;
+    if ( tmpFile.Open(_T("test2")) && tmpFile.Write(_T("the answer is 42")) )
+    {
+        if ( tmpFile.Commit() )
+            wxPuts(_T("File committed."));
+        else
+            wxPuts(_T("ERROR: could't commit temp file."));
+
+        wxRemoveFile(_T("test2"));
+    }
+
+    wxPuts(wxEmptyString);
+}
+
 #endif // TEST_FILE
 
 // ----------------------------------------------------------------------------
@@ -4304,6 +4322,7 @@ int main(int argc, char **argv)
     TestFileRead();
     TestTextFileRead();
     TestFileCopy();
+    TestTempFile();
 #endif // TEST_FILE
 
 #ifdef TEST_FILENAME