Changed the error output to be clearer and more simple

git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@96 860be788-9bd5-4423-9f1e-828f051e677b
This commit is contained in:
mat007 2010-01-21 16:07:08 +00:00
parent 7f7c696505
commit e07c59c436
2 changed files with 15 additions and 17 deletions

View file

@ -160,8 +160,7 @@ namespace detail
friend std::ostream& operator<<( std::ostream& s, const matcher& m ) friend std::ostream& operator<<( std::ostream& s, const matcher& m )
{ {
return s << (m.i_->is_valid() ? '.' : 'v') return s << (m.i_->is_valid() ? '.' : 'v') << ' ' << *m.i_;
<< " expect( " << *m.i_ << " )";
} }
}; };
@ -199,8 +198,7 @@ namespace detail
MOCK_MATCHER_METHODS \ MOCK_MATCHER_METHODS \
friend std::ostream& operator<<( std::ostream& s, const matcher& m ) \ friend std::ostream& operator<<( std::ostream& s, const matcher& m ) \
{ \ { \
return s << (m.i_->is_valid() ? '.' : 'v') \ return s << (m.i_->is_valid() ? '.' : 'v') << ' ' << *m.i_ << ".with( " \
<< " expect( " << *m.i_ << " ).with( " \
<< m.c0_ \ << m.c0_ \
BOOST_PP_REPEAT_FROM_TO(1, n, MOCK_MATCHER_SERIALIZE, BOOST_PP_EMPTY) \ BOOST_PP_REPEAT_FROM_TO(1, n, MOCK_MATCHER_SERIALIZE, BOOST_PP_EMPTY) \
<< " )"; \ << " )"; \

View file

@ -595,8 +595,8 @@ BOOST_FIXTURE_TEST_CASE( expectation_can_be_serialized_to_be_human_readable, err
e.expect().once().with( 2 ); e.expect().once().with( 2 );
BOOST_CHECK_NO_THROW( e( 2 ) ); BOOST_CHECK_NO_THROW( e( 2 ) );
const std::string expected = "my expectation\n" const std::string expected = "my expectation\n"
". expect( once() ).with( 1 )\n" ". once().with( 1 )\n"
"v expect( once() ).with( 2 )"; "v once().with( 2 )";
BOOST_CHECK_EQUAL( expected, to_string( e ) ); BOOST_CHECK_EQUAL( expected, to_string( e ) );
e.reset(); e.reset();
} }
@ -605,7 +605,7 @@ BOOST_FIXTURE_TEST_CASE( expectation_can_be_serialized_to_be_human_readable, err
e.tag( "my expectation" ); e.tag( "my expectation" );
e.expect().never().with( 1 ); e.expect().never().with( 1 );
const std::string expected = "my expectation\n" const std::string expected = "my expectation\n"
"v expect( never() ).with( 1 )"; "v never().with( 1 )";
BOOST_CHECK_EQUAL( expected, to_string( e ) ); BOOST_CHECK_EQUAL( expected, to_string( e ) );
e.reset(); e.reset();
} }
@ -616,15 +616,15 @@ BOOST_FIXTURE_TEST_CASE( expectation_can_be_serialized_to_be_human_readable, err
BOOST_CHECK_NO_THROW( e( "second" ) ); BOOST_CHECK_NO_THROW( e( "second" ) );
{ {
const std::string expected = "?\n" const std::string expected = "?\n"
"v expect( never() ).with( less( \"first\" ) )\n" "v never().with( less( \"first\" ) )\n"
". expect( exactly( 1/2 ) ).with( \"second\" )"; ". exactly( 1/2 ).with( \"second\" )";
BOOST_CHECK_EQUAL( expected, to_string( e ) ); BOOST_CHECK_EQUAL( expected, to_string( e ) );
} }
BOOST_CHECK_NO_THROW( e( "second" ) ); BOOST_CHECK_NO_THROW( e( "second" ) );
{ {
const std::string expected = "?\n" const std::string expected = "?\n"
"v expect( never() ).with( less( \"first\" ) )\n" "v never().with( less( \"first\" ) )\n"
"v expect( exactly( 2/2 ) ).with( \"second\" )"; "v exactly( 2/2 ).with( \"second\" )";
BOOST_CHECK_EQUAL( expected, to_string( e ) ); BOOST_CHECK_EQUAL( expected, to_string( e ) );
} }
e.reset(); e.reset();
@ -634,7 +634,7 @@ BOOST_FIXTURE_TEST_CASE( expectation_can_be_serialized_to_be_human_readable, err
e.tag( "my expectation" ); e.tag( "my expectation" );
e.expect().once(); e.expect().once();
const std::string expected = "my expectation\n" const std::string expected = "my expectation\n"
". expect( once() ).with( any )"; ". once().with( any )";
BOOST_CHECK_EQUAL( expected, to_string( e ) ); BOOST_CHECK_EQUAL( expected, to_string( e ) );
e.reset(); e.reset();
} }
@ -643,7 +643,7 @@ BOOST_FIXTURE_TEST_CASE( expectation_can_be_serialized_to_be_human_readable, err
e.tag( "my expectation" ); e.tag( "my expectation" );
e.expect().once().with( mock::any ); e.expect().once().with( mock::any );
const std::string expected = "my expectation\n" const std::string expected = "my expectation\n"
". expect( once() ).with( any )"; ". once().with( any )";
BOOST_CHECK_EQUAL( expected, to_string( e ) ); BOOST_CHECK_EQUAL( expected, to_string( e ) );
e.reset(); e.reset();
} }
@ -652,7 +652,7 @@ BOOST_FIXTURE_TEST_CASE( expectation_can_be_serialized_to_be_human_readable, err
e.tag( "my expectation" ); e.tag( "my expectation" );
e.expect().once(); e.expect().once();
const std::string expected = "my expectation\n" const std::string expected = "my expectation\n"
". expect( once() ).with( any )"; ". once().with( any )";
BOOST_CHECK_EQUAL( expected, to_string( e ) ); BOOST_CHECK_EQUAL( expected, to_string( e ) );
e.reset(); e.reset();
} }
@ -661,7 +661,7 @@ BOOST_FIXTURE_TEST_CASE( expectation_can_be_serialized_to_be_human_readable, err
e.tag( "my expectation" ); e.tag( "my expectation" );
e.expect().once().with( &custom_constraint ); e.expect().once().with( &custom_constraint );
const std::string expected = "my expectation\n" const std::string expected = "my expectation\n"
". expect( once() ).with( ? )"; ". once().with( ? )";
BOOST_CHECK_EQUAL( expected, to_string( e ) ); BOOST_CHECK_EQUAL( expected, to_string( e ) );
e.reset(); e.reset();
} }
@ -670,7 +670,7 @@ BOOST_FIXTURE_TEST_CASE( expectation_can_be_serialized_to_be_human_readable, err
e.tag( "my expectation" ); e.tag( "my expectation" );
e.expect().once().with( mock::constraint( &custom_constraint, "custom constraint" ) ); e.expect().once().with( mock::constraint( &custom_constraint, "custom constraint" ) );
const std::string expected = "my expectation\n" const std::string expected = "my expectation\n"
". expect( once() ).with( custom constraint )"; ". once().with( custom constraint )";
BOOST_CHECK_EQUAL( expected, to_string( e ) ); BOOST_CHECK_EQUAL( expected, to_string( e ) );
e.reset(); e.reset();
} }
@ -679,7 +679,7 @@ BOOST_FIXTURE_TEST_CASE( expectation_can_be_serialized_to_be_human_readable, err
e.tag( "my expectation" ); e.tag( "my expectation" );
e.expect().once().with( mock::constraint( &custom_constraint, true ) ); e.expect().once().with( mock::constraint( &custom_constraint, true ) );
const std::string expected = "my expectation\n" const std::string expected = "my expectation\n"
". expect( once() ).with( true )"; ". once().with( true )";
BOOST_CHECK_EQUAL( expected, to_string( e ) ); BOOST_CHECK_EQUAL( expected, to_string( e ) );
e.reset(); e.reset();
} }