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/repeat_from_to.hpp>
|
||||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||||
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||||
|
#include <exception>
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
||||||
|
|
@ -59,11 +60,12 @@ namespace mock
|
||||||
virtual ~expectation()
|
virtual ~expectation()
|
||||||
{
|
{
|
||||||
parent_->remove( *this );
|
parent_->remove( *this );
|
||||||
for( matchers_cit it = matchers_.begin();
|
if( ! std::uncaught_exception() )
|
||||||
it != matchers_.end(); ++it )
|
for( matchers_cit it = matchers_.begin();
|
||||||
if( valid_ && ! it->verify() )
|
it != matchers_.end(); ++it )
|
||||||
ErrorPolicy::untriggered_expectation(
|
if( valid_ && ! it->verify() )
|
||||||
context(), it->file(), it->line() );
|
ErrorPolicy::untriggered_expectation(
|
||||||
|
context(), it->file(), it->line() );
|
||||||
}
|
}
|
||||||
|
|
||||||
expectation& set_name( const std::string& name )
|
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();
|
e.expect().once();
|
||||||
untriggered_expectation_exp.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