diff --git a/turtle/detail/expectation_template.hpp b/turtle/detail/expectation_template.hpp index fe64365..2bd6285 100644 --- a/turtle/detail/expectation_template.hpp +++ b/turtle/detail/expectation_template.hpp @@ -53,6 +53,7 @@ namespace detail { BOOST_PP_REPEAT(MOCK_NUM_ARGS, MOCK_EXPECTATION_TYPEDEF, _) + public: expectation() : BOOST_PP_REPEAT(MOCK_NUM_ARGS, @@ -62,6 +63,14 @@ namespace detail , file_( "unknown location" ) , 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() { @@ -117,12 +126,6 @@ namespace detail BOOST_PP_REPEAT(MOCK_MAX_SEQUENCES, MOCK_EXPECTATION_IN, _) - void set_location( const char* file, int line ) - { - file_ = file; - line_ = line; - } - bool verify() const { return i_->verify(); diff --git a/turtle/detail/function_impl_template.hpp b/turtle/detail/function_impl_template.hpp index 68c8259..de8c1ec 100644 --- a/turtle/detail/function_impl_template.hpp +++ b/turtle/detail/function_impl_template.hpp @@ -85,9 +85,9 @@ namespace detail expectation_type& expect( const char* file, int line ) { - expectation_type& e = expect(); - e.set_location( file, line ); - return e; + expectations_.push_back( expectation_type( file, line ) ); + valid_ = true; + return expectations_.back(); } expectation_type& expect() {