From 59062ec1139882af2178354003df5144e4ab8dc7 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 4 Nov 2006 18:25:08 +0000 Subject: [PATCH] add wxTempFile test git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43050 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- samples/console/console.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/samples/console/console.cpp b/samples/console/console.cpp index a151a12468..90548b2445 100644 --- a/samples/console/console.cpp +++ b/samples/console/console.cpp @@ -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 -- 2.47.2