From 3e1687c36babff34057722aae5780838177abaad Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 4 Jul 2021 13:56:24 +0100 Subject: [PATCH] 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. --- tests/file/filefn.cpp | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/tests/file/filefn.cpp b/tests/file/filefn.cpp index 8962dc6bd9..8f2c4c10a2 100644 --- a/tests/file/filefn.cpp +++ b/tests/file/filefn.cpp @@ -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() ); }