From 1adebefb50d33569d792daed16c541949358b7cd Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Wed, 29 Jun 2011 19:22:56 +0100 Subject: [PATCH] Fixed tests with string literal on lhs --- include/catch.hpp | 2 +- include/internal/catch_capture.hpp | 11 +++++++++++ projects/SelfTest/ConditionTests.cpp | 1 + projects/SelfTest/TestMain.cpp | 2 +- 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/include/catch.hpp b/include/catch.hpp index 4925e334..5a297ede 100644 --- a/include/catch.hpp +++ b/include/catch.hpp @@ -15,7 +15,7 @@ Next: Later: - Finish command line parser (list as xml, specify FP tolerance) + Finish command line parser (list as xml) Tags? Finish macros, listed here, later (just CHECK_NOFAIL now) */ diff --git a/include/internal/catch_capture.hpp b/include/internal/catch_capture.hpp index 705e4ff7..f9bb54fe 100644 --- a/include/internal/catch_capture.hpp +++ b/include/internal/catch_capture.hpp @@ -546,6 +546,17 @@ public: return expr; } + /////////////////////////////////////////////////////////////////////////// + Expression operator->* + ( + const char* operand + ) + { + Expression expr( m_result, operand ); + + return expr; + } + /////////////////////////////////////////////////////////////////////////// template PtrExpression operator->* diff --git a/projects/SelfTest/ConditionTests.cpp b/projects/SelfTest/ConditionTests.cpp index f54cb4cc..91d9f627 100644 --- a/projects/SelfTest/ConditionTests.cpp +++ b/projects/SelfTest/ConditionTests.cpp @@ -43,6 +43,7 @@ TEST_CASE( "./succeeding/conditions/equality", REQUIRE( data.float_nine_point_one == Approx( 9.1f ) ); REQUIRE( data.double_pi == Approx( 3.1415926535 ) ); REQUIRE( data.str_hello == "hello" ); + REQUIRE( "hello" == data.str_hello ); REQUIRE( data.str_hello.size() == 5 ); double x = 1.1 + 0.1 + 0.1; diff --git a/projects/SelfTest/TestMain.cpp b/projects/SelfTest/TestMain.cpp index f22bdf30..c87e2ec9 100644 --- a/projects/SelfTest/TestMain.cpp +++ b/projects/SelfTest/TestMain.cpp @@ -47,7 +47,7 @@ TEST_CASE( "selftest/main", "Runs all Catch self tests and checks their results" "Number of 'succeeding' tests is fixed" ) { runner.runMatching( "./succeeding/*" ); - CHECK( runner.getSuccessCount() == 248 ); + CHECK( runner.getSuccessCount() == 249 ); CHECK( runner.getFailureCount() == 0 ); }