From e07c59c4365ce4044de60faceb33a2dad0e8da80 Mon Sep 17 00:00:00 2001 From: mat007 Date: Thu, 21 Jan 2010 16:07:08 +0000 Subject: [PATCH] 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 --- src/libraries/turtle/matcher.hpp | 6 ++--- src/tests/turtle_test/expectation_test.cpp | 26 +++++++++++----------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/src/libraries/turtle/matcher.hpp b/src/libraries/turtle/matcher.hpp index c0bf40b..113c925 100644 --- a/src/libraries/turtle/matcher.hpp +++ b/src/libraries/turtle/matcher.hpp @@ -160,8 +160,7 @@ namespace detail friend std::ostream& operator<<( std::ostream& s, const matcher& m ) { - return s << (m.i_->is_valid() ? '.' : 'v') - << " expect( " << *m.i_ << " )"; + return s << (m.i_->is_valid() ? '.' : 'v') << ' ' << *m.i_; } }; @@ -199,8 +198,7 @@ namespace detail MOCK_MATCHER_METHODS \ friend std::ostream& operator<<( std::ostream& s, const matcher& m ) \ { \ - return s << (m.i_->is_valid() ? '.' : 'v') \ - << " expect( " << *m.i_ << " ).with( " \ + return s << (m.i_->is_valid() ? '.' : 'v') << ' ' << *m.i_ << ".with( " \ << m.c0_ \ BOOST_PP_REPEAT_FROM_TO(1, n, MOCK_MATCHER_SERIALIZE, BOOST_PP_EMPTY) \ << " )"; \ diff --git a/src/tests/turtle_test/expectation_test.cpp b/src/tests/turtle_test/expectation_test.cpp index 3d748e5..1f158fd 100644 --- a/src/tests/turtle_test/expectation_test.cpp +++ b/src/tests/turtle_test/expectation_test.cpp @@ -595,8 +595,8 @@ BOOST_FIXTURE_TEST_CASE( expectation_can_be_serialized_to_be_human_readable, err e.expect().once().with( 2 ); BOOST_CHECK_NO_THROW( e( 2 ) ); const std::string expected = "my expectation\n" - ". expect( once() ).with( 1 )\n" - "v expect( once() ).with( 2 )"; + ". once().with( 1 )\n" + "v once().with( 2 )"; BOOST_CHECK_EQUAL( expected, to_string( e ) ); e.reset(); } @@ -605,7 +605,7 @@ BOOST_FIXTURE_TEST_CASE( expectation_can_be_serialized_to_be_human_readable, err e.tag( "my expectation" ); e.expect().never().with( 1 ); const std::string expected = "my expectation\n" - "v expect( never() ).with( 1 )"; + "v never().with( 1 )"; BOOST_CHECK_EQUAL( expected, to_string( e ) ); 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" ) ); { const std::string expected = "?\n" - "v expect( never() ).with( less( \"first\" ) )\n" - ". expect( exactly( 1/2 ) ).with( \"second\" )"; + "v never().with( less( \"first\" ) )\n" + ". exactly( 1/2 ).with( \"second\" )"; BOOST_CHECK_EQUAL( expected, to_string( e ) ); } BOOST_CHECK_NO_THROW( e( "second" ) ); { const std::string expected = "?\n" - "v expect( never() ).with( less( \"first\" ) )\n" - "v expect( exactly( 2/2 ) ).with( \"second\" )"; + "v never().with( less( \"first\" ) )\n" + "v exactly( 2/2 ).with( \"second\" )"; BOOST_CHECK_EQUAL( expected, to_string( e ) ); } e.reset(); @@ -634,7 +634,7 @@ BOOST_FIXTURE_TEST_CASE( expectation_can_be_serialized_to_be_human_readable, err e.tag( "my expectation" ); e.expect().once(); const std::string expected = "my expectation\n" - ". expect( once() ).with( any )"; + ". once().with( any )"; BOOST_CHECK_EQUAL( expected, to_string( e ) ); e.reset(); } @@ -643,7 +643,7 @@ BOOST_FIXTURE_TEST_CASE( expectation_can_be_serialized_to_be_human_readable, err e.tag( "my expectation" ); e.expect().once().with( mock::any ); const std::string expected = "my expectation\n" - ". expect( once() ).with( any )"; + ". once().with( any )"; BOOST_CHECK_EQUAL( expected, to_string( e ) ); e.reset(); } @@ -652,7 +652,7 @@ BOOST_FIXTURE_TEST_CASE( expectation_can_be_serialized_to_be_human_readable, err e.tag( "my expectation" ); e.expect().once(); const std::string expected = "my expectation\n" - ". expect( once() ).with( any )"; + ". once().with( any )"; BOOST_CHECK_EQUAL( expected, to_string( e ) ); e.reset(); } @@ -661,7 +661,7 @@ BOOST_FIXTURE_TEST_CASE( expectation_can_be_serialized_to_be_human_readable, err e.tag( "my expectation" ); e.expect().once().with( &custom_constraint ); const std::string expected = "my expectation\n" - ". expect( once() ).with( ? )"; + ". once().with( ? )"; BOOST_CHECK_EQUAL( expected, to_string( e ) ); e.reset(); } @@ -670,7 +670,7 @@ BOOST_FIXTURE_TEST_CASE( expectation_can_be_serialized_to_be_human_readable, err e.tag( "my expectation" ); e.expect().once().with( mock::constraint( &custom_constraint, "custom constraint" ) ); const std::string expected = "my expectation\n" - ". expect( once() ).with( custom constraint )"; + ". once().with( custom constraint )"; BOOST_CHECK_EQUAL( expected, to_string( e ) ); e.reset(); } @@ -679,7 +679,7 @@ BOOST_FIXTURE_TEST_CASE( expectation_can_be_serialized_to_be_human_readable, err e.tag( "my expectation" ); e.expect().once().with( mock::constraint( &custom_constraint, true ) ); const std::string expected = "my expectation\n" - ". expect( once() ).with( true )"; + ". once().with( true )"; BOOST_CHECK_EQUAL( expected, to_string( e ) ); e.reset(); }