mirror of
https://github.com/catchorg/Catch2.git
synced 2024-12-23 11:43:29 +01:00
Matchers macro uses Catch::Matchers namespace internally - so it doesn't have to be declared with "using" first
This commit is contained in:
parent
1c98fc98ef
commit
7035b55832
@ -126,7 +126,7 @@ inline bool isTrue( bool value ){ return value; }
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#define INTERNAL_CHECK_THAT( arg, matcher, stopOnFailure, macroName ) \
|
||||
do{ try{ \
|
||||
INTERNAL_CATCH_ACCEPT_EXPR( ( Catch::ExpressionBuilder( CATCH_INTERNAL_LINEINFO, macroName, #arg " " #matcher, false ).acceptMatcher( matcher, arg, #matcher ) ), stopOnFailure, false ); \
|
||||
INTERNAL_CATCH_ACCEPT_EXPR( ( Catch::ExpressionBuilder( CATCH_INTERNAL_LINEINFO, macroName, #arg " " #matcher, false ).acceptMatcher( ::Catch::Matchers::matcher, arg, #matcher ) ), stopOnFailure, false ); \
|
||||
}catch( Catch::TestFailureException& ){ \
|
||||
throw; \
|
||||
} catch( ... ){ \
|
||||
|
@ -178,7 +178,6 @@ namespace Catch {
|
||||
mutable std::ostream m_os;
|
||||
Include::What m_includeWhat;
|
||||
std::string m_name;
|
||||
|
||||
};
|
||||
|
||||
} // end namespace Catch
|
||||
|
@ -247,8 +247,6 @@ inline const char* testStringForMatching()
|
||||
return "this string contains 'abc' as a substring";
|
||||
}
|
||||
|
||||
using namespace Catch::Matchers;
|
||||
|
||||
TEST_CASE("./succeeding/matchers", "")
|
||||
{
|
||||
REQUIRE_THAT( testStringForMatching(), Contains( "string" ) );
|
||||
@ -272,3 +270,13 @@ TEST_CASE("./failing/matchers/EndsWith", "")
|
||||
{
|
||||
CHECK_THAT( testStringForMatching(), EndsWith( "this" ) );
|
||||
}
|
||||
|
||||
TEST_CASE("./failing/matchers/Equals", "")
|
||||
{
|
||||
CHECK_THAT( testStringForMatching(), Equals( "something else" ) );
|
||||
}
|
||||
|
||||
TEST_CASE("./succeeding/matchers/Equals", "")
|
||||
{
|
||||
CHECK_THAT( testStringForMatching(), Equals( "this string contains 'abc' as a substring" ) );
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ TEST_CASE( "selftest/main", "Runs all Catch self tests and checks their results"
|
||||
SECTION( "selftest/test counts/succeeding tests",
|
||||
"Number of 'succeeding' tests is fixed" ) {
|
||||
runner.runMatching( "./succeeding/*" );
|
||||
CHECK( runner.getTotals().assertions.passed == 276 );
|
||||
CHECK( runner.getTotals().assertions.passed == 277 );
|
||||
CHECK( runner.getTotals().assertions.failed == 0 );
|
||||
}
|
||||
|
||||
@ -41,7 +41,7 @@ TEST_CASE( "selftest/main", "Runs all Catch self tests and checks their results"
|
||||
"Number of 'failing' tests is fixed" ) {
|
||||
runner.runMatching( "./failing/*" );
|
||||
CHECK( runner.getTotals().assertions.passed == 0 );
|
||||
CHECK( runner.getTotals().assertions.failed == 71 );
|
||||
CHECK( runner.getTotals().assertions.failed == 72 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -60,7 +60,6 @@ void useObject( const T& object ){}
|
||||
template<typename T>
|
||||
void useObject( const T* object ){}
|
||||
|
||||
using namespace Catch::Matchers;
|
||||
OC_TEST_CASE( "OCTest/matchers", "Matches work with OC types (NSString so far)" )
|
||||
{
|
||||
REQUIRE_THAT( @"This is a string", Equals( @"This is a string" ) );
|
||||
|
Loading…
Reference in New Issue
Block a user