From f3e7722cc604793f6d07eee1afa912f3e095a6f7 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Thu, 5 Nov 2015 18:10:33 +0000 Subject: [PATCH] Don't introduce Catch::Matchers namespace in macro - this could be a breaking change - fixed up self-test code to compensate --- include/internal/catch_capture.hpp | 4 ++-- projects/SelfTest/MiscTests.cpp | 1 + projects/SelfTest/TagAliasTests.cpp | 2 ++ projects/SelfTest/TestMain.cpp | 2 ++ 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/include/internal/catch_capture.hpp b/include/internal/catch_capture.hpp index 544fc120..22cf6959 100644 --- a/include/internal/catch_capture.hpp +++ b/include/internal/catch_capture.hpp @@ -131,12 +131,12 @@ do { \ Catch::ResultBuilder __catchResult( macroName, CATCH_INTERNAL_LINEINFO, #arg " " #matcher, resultDisposition ); \ try { \ - std::string matcherAsString = ::Catch::Matchers::matcher.toString(); \ + std::string matcherAsString = (matcher).toString(); \ __catchResult \ .setLhs( Catch::toString( arg ) ) \ .setRhs( matcherAsString == Catch::Detail::unprintableString ? #matcher : matcherAsString ) \ .setOp( "matches" ) \ - .setResultType( ::Catch::Matchers::matcher.match( arg ) ); \ + .setResultType( (matcher).match( arg ) ); \ __catchResult.captureExpression(); \ } catch( ... ) { \ __catchResult.useActiveException( resultDisposition | Catch::ResultDisposition::ContinueOnFailure ); \ diff --git a/projects/SelfTest/MiscTests.cpp b/projects/SelfTest/MiscTests.cpp index 70a6cee1..8bd271c4 100644 --- a/projects/SelfTest/MiscTests.cpp +++ b/projects/SelfTest/MiscTests.cpp @@ -208,6 +208,7 @@ inline const char* testStringForMatching() { return "this string contains 'abc' as a substring"; } +using namespace Catch::Matchers; TEST_CASE("String matchers", "[matchers]" ) { diff --git a/projects/SelfTest/TagAliasTests.cpp b/projects/SelfTest/TagAliasTests.cpp index b95ad009..002a93c0 100644 --- a/projects/SelfTest/TagAliasTests.cpp +++ b/projects/SelfTest/TagAliasTests.cpp @@ -11,6 +11,8 @@ TEST_CASE( "Tag alias can be registered against tag patterns", "" ) { + using namespace Catch::Matchers; + Catch::TagAliasRegistry registry; registry.add( "[@zzz]", "[one][two]", Catch::SourceLineInfo( "file", 2 ) ); diff --git a/projects/SelfTest/TestMain.cpp b/projects/SelfTest/TestMain.cpp index f8d17fdd..bffc7e77 100644 --- a/projects/SelfTest/TestMain.cpp +++ b/projects/SelfTest/TestMain.cpp @@ -44,6 +44,8 @@ inline Catch::TestCase fakeTestCase( const char* name, const char* desc = "" ){ TEST_CASE( "Process can be configured on command line", "[config][command-line]" ) { + using namespace Catch::Matchers; + Catch::ConfigData config; SECTION( "default - no arguments", "" ) {