Use WX_ASSERT_FAILS_WITH_ASSERT in file functions test case

Make the code shorter and more clear by using an existing macro checking
that the expected assert happens instead of writing it out.
This commit is contained in:
Vadim Zeitlin 2021-07-04 13:56:24 +01:00
parent 723265f9ef
commit 3e1687c36b

View File

@ -465,16 +465,7 @@ void FileFunctionsTestCase::FileEof()
CPPUNIT_ASSERT_MESSAGE( msg, file.Close() );
// wxFFile::Eof after close should not cause crash but fail instead
bool failed = true;
try
{
file.Eof();
failed = false;
}
catch (...)
{
}
CPPUNIT_ASSERT_MESSAGE( msg, failed );
WX_ASSERT_FAILS_WITH_ASSERT( file.Eof() );
}
void FileFunctionsTestCase::FileError()
@ -491,16 +482,7 @@ void FileFunctionsTestCase::FileError()
CPPUNIT_ASSERT_MESSAGE( msg, file.Close() );
// wxFFile::Error after close should not cause crash but fail instead
bool failed = true;
try
{
file.Error();
failed = false;
}
catch (...)
{
}
CPPUNIT_ASSERT_MESSAGE( msg, failed );
WX_ASSERT_FAILS_WITH_ASSERT( file.Error() );
}