Remove temporary files created by wxFileName unit test case.
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
This commit is contained in:
@@ -24,6 +24,7 @@
|
|||||||
#include "wx/filename.h"
|
#include "wx/filename.h"
|
||||||
#include "wx/filefn.h"
|
#include "wx/filefn.h"
|
||||||
#include "wx/stdpaths.h"
|
#include "wx/stdpaths.h"
|
||||||
|
#include "wx/scopeguard.h"
|
||||||
|
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
#include "wx/msw/registry.h"
|
#include "wx/msw/registry.h"
|
||||||
@@ -639,6 +640,7 @@ void FileNameTestCase::TestGetTimes()
|
|||||||
{
|
{
|
||||||
wxFileName fn(wxFileName::CreateTempFileName("filenametest"));
|
wxFileName fn(wxFileName::CreateTempFileName("filenametest"));
|
||||||
CPPUNIT_ASSERT( fn.IsOk() );
|
CPPUNIT_ASSERT( fn.IsOk() );
|
||||||
|
wxON_BLOCK_EXIT1( wxRemoveFile, fn.GetFullPath() );
|
||||||
|
|
||||||
wxDateTime dtAccess, dtMod, dtCreate;
|
wxDateTime dtAccess, dtMod, dtCreate;
|
||||||
CPPUNIT_ASSERT( fn.GetTimes(&dtAccess, &dtMod, &dtCreate) );
|
CPPUNIT_ASSERT( fn.GetTimes(&dtAccess, &dtMod, &dtCreate) );
|
||||||
@@ -654,6 +656,7 @@ void FileNameTestCase::TestExists()
|
|||||||
{
|
{
|
||||||
wxFileName fn(wxFileName::CreateTempFileName("filenametest"));
|
wxFileName fn(wxFileName::CreateTempFileName("filenametest"));
|
||||||
CPPUNIT_ASSERT( fn.IsOk() );
|
CPPUNIT_ASSERT( fn.IsOk() );
|
||||||
|
wxON_BLOCK_EXIT1( wxRemoveFile, fn.GetFullPath() );
|
||||||
|
|
||||||
CPPUNIT_ASSERT( fn.FileExists() );
|
CPPUNIT_ASSERT( fn.FileExists() );
|
||||||
CPPUNIT_ASSERT( !wxFileName::DirExists(fn.GetFullPath()) );
|
CPPUNIT_ASSERT( !wxFileName::DirExists(fn.GetFullPath()) );
|
||||||
|
Reference in New Issue
Block a user