Don't unnecessarily use heap-allocated objects in a test
Just use local stack variables instead.
This commit is contained in:
@@ -109,23 +109,20 @@ void TextStreamTestCase::Endline()
|
|||||||
{
|
{
|
||||||
TempFile f("test.txt");
|
TempFile f("test.txt");
|
||||||
|
|
||||||
wxFileOutputStream* pOutFile = new wxFileOutputStream(f.GetName());
|
{
|
||||||
wxTextOutputStream* pOutText = new wxTextOutputStream(*pOutFile);
|
wxFileOutputStream pOutFile(f.GetName());
|
||||||
*pOutText << wxT("Test text") << endl
|
wxTextOutputStream pOutText(pOutFile);
|
||||||
<< wxT("More Testing Text (There should be newline before this)");
|
pOutText << wxT("Test text") << endl
|
||||||
|
<< wxT("More Testing Text (There should be newline before this)");
|
||||||
|
}
|
||||||
|
|
||||||
delete pOutText;
|
wxFileInputStream pInFile(f.GetName());
|
||||||
delete pOutFile;
|
|
||||||
|
|
||||||
wxFileInputStream* pInFile = new wxFileInputStream(f.GetName());
|
|
||||||
|
|
||||||
char szIn[9 + NEWLINELEN];
|
char szIn[9 + NEWLINELEN];
|
||||||
|
|
||||||
pInFile->Read(szIn, 9 + NEWLINELEN);
|
pInFile.Read(szIn, 9 + NEWLINELEN);
|
||||||
|
|
||||||
CPPUNIT_ASSERT( memcmp(&szIn[9], NEWLINE, NEWLINELEN) == 0 );
|
CPPUNIT_ASSERT( memcmp(&szIn[9], NEWLINE, NEWLINELEN) == 0 );
|
||||||
|
|
||||||
delete pInFile;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextStreamTestCase::MiscTests()
|
void TextStreamTestCase::MiscTests()
|
||||||
|
Reference in New Issue
Block a user