mirror of
https://github.com/mat007/turtle.git
synced 2026-06-22 12:13:43 +00:00
Throwing an exception disables the automatic verification upon destruction
git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@15 860be788-9bd5-4423-9f1e-828f051e677b
This commit is contained in:
parent
42d1e5add3
commit
7781ba4e58
2 changed files with 19 additions and 5 deletions
|
|
@ -22,6 +22,7 @@
|
|||
#include <boost/preprocessor/repetition/repeat_from_to.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
#include <exception>
|
||||
#include <ostream>
|
||||
#include <list>
|
||||
|
||||
|
|
@ -59,11 +60,12 @@ namespace mock
|
|||
virtual ~expectation()
|
||||
{
|
||||
parent_->remove( *this );
|
||||
for( matchers_cit it = matchers_.begin();
|
||||
it != matchers_.end(); ++it )
|
||||
if( valid_ && ! it->verify() )
|
||||
ErrorPolicy::untriggered_expectation(
|
||||
context(), it->file(), it->line() );
|
||||
if( ! std::uncaught_exception() )
|
||||
for( matchers_cit it = matchers_.begin();
|
||||
it != matchers_.end(); ++it )
|
||||
if( valid_ && ! it->verify() )
|
||||
ErrorPolicy::untriggered_expectation(
|
||||
context(), it->file(), it->line() );
|
||||
}
|
||||
|
||||
expectation& set_name( const std::string& name )
|
||||
|
|
|
|||
|
|
@ -760,3 +760,15 @@ BOOST_FIXTURE_TEST_CASE( adding_a_matcher_reactivates_the_verification_upon_dest
|
|||
e.expect().once();
|
||||
untriggered_expectation_exp.expect().once();
|
||||
}
|
||||
|
||||
BOOST_FIXTURE_TEST_CASE( throwing_an_exception_disables_the_automatic_verification_upon_destruction, error_guard )
|
||||
{
|
||||
try
|
||||
{
|
||||
mock::expectation< void(), mock_error > e;
|
||||
e.expect().once();
|
||||
throw std::exception();
|
||||
}
|
||||
catch( std::exception& )
|
||||
{}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue