]> git.saurik.com Git - wxWidgets.git/commitdiff
Remove temporary files created by wxFileName unit test case.
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 25 Feb 2012 23:49:32 +0000 (23:49 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 25 Feb 2012 23:49:32 +0000 (23:49 +0000)
Don't leave temporary files created by wxFileName::CreateTempFileName() lying
around.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70686 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

tests/filename/filenametest.cpp

index b46ecff63affbd57c4047282ad48e8da89944492..56474483454c5c82d8da349ac3baf93abc11184e 100644 (file)
@@ -24,6 +24,7 @@
 #include "wx/filename.h"
 #include "wx/filefn.h"
 #include "wx/stdpaths.h"
+#include "wx/scopeguard.h"
 
 #ifdef __WXMSW__
     #include "wx/msw/registry.h"
@@ -639,6 +640,7 @@ void FileNameTestCase::TestGetTimes()
 {
     wxFileName fn(wxFileName::CreateTempFileName("filenametest"));
     CPPUNIT_ASSERT( fn.IsOk() );
+    wxON_BLOCK_EXIT1( wxRemoveFile, fn.GetFullPath() );
 
     wxDateTime dtAccess, dtMod, dtCreate;
     CPPUNIT_ASSERT( fn.GetTimes(&dtAccess, &dtMod, &dtCreate) );
@@ -654,6 +656,7 @@ void FileNameTestCase::TestExists()
 {
     wxFileName fn(wxFileName::CreateTempFileName("filenametest"));
     CPPUNIT_ASSERT( fn.IsOk() );
+    wxON_BLOCK_EXIT1( wxRemoveFile, fn.GetFullPath() );
 
     CPPUNIT_ASSERT( fn.FileExists() );
     CPPUNIT_ASSERT( !wxFileName::DirExists(fn.GetFullPath()) );