Added checkpoint notification to error policy

git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@411 860be788-9bd5-4423-9f1e-828f051e677b
This commit is contained in:
mat007 2012-02-07 23:00:31 +00:00
parent e86aebb5a8
commit f66e06f4fe
5 changed files with 27 additions and 4 deletions

View file

@ -30,6 +30,12 @@ namespace mock
throw boost::enable_current_exception( exception() );
}
static void checkpoint( const char* file, int line )
{
boost::unit_test::unit_test_log.set_checkpoint( file,
(std::size_t)line );
}
template< typename Context >
static void fail(
const char* message, const Context& context,

View file

@ -24,6 +24,9 @@ namespace mock
throw exception();
}
static void checkpoint( const char* /*file*/, int /*line*/ )
{}
template< typename Context >
static void fail(
const char* message, const Context& context,

View file

@ -61,14 +61,25 @@ namespace mock
{
return impl_->verify();
}
bool verify( const char* file, int line ) const
{
function_impl::error_type::checkpoint( file, line );
return impl_->verify();
}
void reset()
{
impl_->reset();
}
void reset( const char* file, int line )
{
function_impl::error_type::checkpoint( file, line );
return impl_->reset();
}
expectation_type& expect( const char* file, int line )
{
return impl_->expect( file, line );
function_impl::error_type::checkpoint( file, line );
return impl_->expect();
}
expectation_type& expect()
{
@ -123,7 +134,7 @@ namespace mock
private:
class function_impl : public verifiable
{
private:
public:
typedef MOCK_ERROR_POLICY< result_type > error_type;
public:

View file

@ -169,7 +169,7 @@ namespace detail
MOCK_FUNCTION_STUB(F, n, S, t, static)
#define MOCK_EXPECT(t) MOCK_MOCKER(t).expect( __FILE__, __LINE__ )
#define MOCK_RESET(t) MOCK_MOCKER(t).reset()
#define MOCK_VERIFY(t) MOCK_MOCKER(t).verify()
#define MOCK_RESET(t) MOCK_MOCKER(t).reset( __FILE__, __LINE__ )
#define MOCK_VERIFY(t) MOCK_MOCKER(t).verify( __FILE__, __LINE__ )
#endif // MOCK_MOCK_HPP_INCLUDED

View file

@ -34,6 +34,9 @@ namespace mock
throw std::runtime_error( "aborted" );
}
static void checkpoint( const char* /*file*/, int /*line*/ )
{}
template< typename Context >
static void missing_action( const Context& context,
const char* /*file*/, int /*line*/ )