Added initial built-in matchers for NSString (ObjC)

This commit is contained in:
Phil Nash
2012-03-04 21:18:46 +00:00
parent a6a40b3ba9
commit 966f5dbff2
4 changed files with 122 additions and 36 deletions

View File

@@ -32,7 +32,7 @@ TEST_CASE( "selftest/main", "Runs all Catch self tests and checks their results"
MetaTestRunner::runMatching( "./succeeding/*", MetaTestRunner::Expected::ToSucceed );
}
}
///////////////////////////////////////////////////////////////////////////
SECTION( "selftest/test counts",
"Number of test cases that run is fixed" )

View File

@@ -42,4 +42,12 @@ OC_TEST_CASE( "OCTest/test2", "This is another test case" )
REQUIRE( obj.int_val == 2 );
}
using namespace Catch::Matchers;
OC_TEST_CASE( "OCTest/matchers", "Matches work with OC types (NSString so far)" )
{
REQUIRE_THAT( @"This is a string", Contains( @"is a" ) );
REQUIRE_THAT( @"This is a string", StartsWith( @"This" ) );
REQUIRE_THAT( @"This is a string", EndsWith( @"string" ) );
}
@end