Refactoring

git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@722 860be788-9bd5-4423-9f1e-828f051e677b
This commit is contained in:
mat007 2014-04-26 07:06:36 +00:00
parent c91d425d87
commit 0e586516c8
2 changed files with 12 additions and 9 deletions

View file

@ -53,6 +53,7 @@ namespace detail
{ {
BOOST_PP_REPEAT(MOCK_NUM_ARGS, BOOST_PP_REPEAT(MOCK_NUM_ARGS,
MOCK_EXPECTATION_TYPEDEF, _) MOCK_EXPECTATION_TYPEDEF, _)
public: public:
expectation() expectation()
: BOOST_PP_REPEAT(MOCK_NUM_ARGS, : BOOST_PP_REPEAT(MOCK_NUM_ARGS,
@ -62,6 +63,14 @@ namespace detail
, file_( "unknown location" ) , file_( "unknown location" )
, line_( 0 ) , line_( 0 )
{} {}
expectation( const char* file, int line )
: BOOST_PP_REPEAT(MOCK_NUM_ARGS,
MOCK_EXPECTATION_INITIALIZE, _)
BOOST_PP_COMMA_IF(MOCK_NUM_ARGS)
i_( boost::make_shared< unlimited >() )
, file_( file )
, line_( line )
{}
~expectation() ~expectation()
{ {
@ -117,12 +126,6 @@ namespace detail
BOOST_PP_REPEAT(MOCK_MAX_SEQUENCES, BOOST_PP_REPEAT(MOCK_MAX_SEQUENCES,
MOCK_EXPECTATION_IN, _) MOCK_EXPECTATION_IN, _)
void set_location( const char* file, int line )
{
file_ = file;
line_ = line;
}
bool verify() const bool verify() const
{ {
return i_->verify(); return i_->verify();

View file

@ -85,9 +85,9 @@ namespace detail
expectation_type& expect( const char* file, int line ) expectation_type& expect( const char* file, int line )
{ {
expectation_type& e = expect(); expectations_.push_back( expectation_type( file, line ) );
e.set_location( file, line ); valid_ = true;
return e; return expectations_.back();
} }
expectation_type& expect() expectation_type& expect()
{ {