mirror of
https://github.com/mat007/turtle.git
synced 2026-06-22 12:13:43 +00:00
Fixed a bug that caused an object to remain invalid forever after being invalid and verified once
git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@424 860be788-9bd5-4423-9f1e-828f051e677b
This commit is contained in:
parent
45d2d58000
commit
209ffa986f
2 changed files with 12 additions and 2 deletions
|
|
@ -209,12 +209,12 @@ namespace mock
|
||||||
<< lazy_expectations( this )
|
<< lazy_expectations( this )
|
||||||
#define MOCK_EXPECTATION_INVOKE(z, n, A) \
|
#define MOCK_EXPECTATION_INVOKE(z, n, A) \
|
||||||
{ \
|
{ \
|
||||||
|
valid_ = false; \
|
||||||
for( expectations_cit it = expectations_.begin(); it != expectations_.end(); ++it ) \
|
for( expectations_cit it = expectations_.begin(); it != expectations_.end(); ++it ) \
|
||||||
if( it->is_valid( BOOST_PP_ENUM_PARAMS(n, p) ) ) \
|
if( it->is_valid( BOOST_PP_ENUM_PARAMS(n, p) ) ) \
|
||||||
{ \
|
{ \
|
||||||
if( ! it->invoke() ) \
|
if( ! it->invoke() ) \
|
||||||
{ \
|
{ \
|
||||||
valid_ = false; \
|
|
||||||
error_type::sequence_failed( MOCK_EXPECTATION_CALL_CONTEXT(n), it->file(), it->line() ); \
|
error_type::sequence_failed( MOCK_EXPECTATION_CALL_CONTEXT(n), it->file(), it->line() ); \
|
||||||
return A; \
|
return A; \
|
||||||
} \
|
} \
|
||||||
|
|
@ -223,10 +223,10 @@ namespace mock
|
||||||
error_type::missing_action( MOCK_EXPECTATION_CALL_CONTEXT(n), it->file(), it->line() ); \
|
error_type::missing_action( MOCK_EXPECTATION_CALL_CONTEXT(n), it->file(), it->line() ); \
|
||||||
return A; \
|
return A; \
|
||||||
} \
|
} \
|
||||||
|
valid_ = true; \
|
||||||
error_type::expected_call( MOCK_EXPECTATION_CALL_CONTEXT(n), it->file(), it->line() ); \
|
error_type::expected_call( MOCK_EXPECTATION_CALL_CONTEXT(n), it->file(), it->line() ); \
|
||||||
return it->functor()( BOOST_PP_ENUM_PARAMS(n, p) ); \
|
return it->functor()( BOOST_PP_ENUM_PARAMS(n, p) ); \
|
||||||
} \
|
} \
|
||||||
valid_ = false; \
|
|
||||||
error_type::unexpected_call( MOCK_EXPECTATION_CALL_CONTEXT(n) ); \
|
error_type::unexpected_call( MOCK_EXPECTATION_CALL_CONTEXT(n) ); \
|
||||||
return A; \
|
return A; \
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -215,6 +215,16 @@ BOOST_FIXTURE_TEST_CASE( verifying_a_once_expectation_before_the_call_fails, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOST_FIXTURE_TEST_CASE( verifying_a_once_expectation_after_a_verify_and_one_call_succeeds, error_fixture )
|
||||||
|
{
|
||||||
|
mock::function< void() > f;
|
||||||
|
f.expect().once();
|
||||||
|
CHECK_ERROR( BOOST_CHECK( ! f.verify() ), verification_failed, 0, "?\n. once()" );
|
||||||
|
f();
|
||||||
|
BOOST_CHECK( f.verify() );
|
||||||
|
CHECK_CALLS( 1 );
|
||||||
|
}
|
||||||
|
|
||||||
// reset
|
// reset
|
||||||
|
|
||||||
BOOST_FIXTURE_TEST_CASE( triggering_a_reset_function_calls_unexpected_call_error, error_fixture )
|
BOOST_FIXTURE_TEST_CASE( triggering_a_reset_function_calls_unexpected_call_error, error_fixture )
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue