Permalink
Browse files

Added an extra tag test

  • Loading branch information...
1 parent 34266b6 commit aafed303bb72d2aa40a3513e714c4c8ad9146c19 @philsquared philsquared committed Oct 17, 2013
Showing with 28 additions and 2 deletions.
  1. +28 −2 projects/SelfTest/TestMain.cpp
@@ -298,15 +298,15 @@ int getArgc( const char * (&)[size] ) {
return size;
}
-TEST_CASE( "selftest/tags", "" ) {
+TEST_CASE( "selftest/tags", "[tags]" ) {
std::string p1 = "[one]";
std::string p2 = "[one],[two]";
std::string p3 = "[one][two]";
std::string p4 = "[one][two],[three]";
std::string p5 = "[one][two]~[.],[three]";
- SECTION( "one tag", "" ) {
+ SECTION( "single [one] tag", "" ) {
Catch::TestCase oneTag = makeTestCase( NULL, "", "test", "[one]", CATCH_INTERNAL_LINEINFO );
CHECK( oneTag.getTestCaseInfo().description == "" );
@@ -320,6 +320,20 @@ TEST_CASE( "selftest/tags", "" ) {
CHECK( oneTag.matchesTags( p5 ) == false );
}
+ SECTION( "single [two] tag", "" ) {
+ Catch::TestCase oneTag = makeTestCase( NULL, "", "test", "[two]", CATCH_INTERNAL_LINEINFO );
+
+ CHECK( oneTag.getTestCaseInfo().description == "" );
+ CHECK( oneTag.hasTag( "two" ) );
+ CHECK( oneTag.getTags().size() == 1 );
+
+ CHECK( oneTag.matchesTags( p1 ) == false );
+ CHECK( oneTag.matchesTags( p2 ) == true );
+ CHECK( oneTag.matchesTags( p3 ) == false );
+ CHECK( oneTag.matchesTags( p4 ) == false );
+ CHECK( oneTag.matchesTags( p5 ) == false );
+ }
+
SECTION( "two tags", "" ) {
Catch::TestCase twoTags= makeTestCase( NULL, "", "test", "[one][two]", CATCH_INTERNAL_LINEINFO );
@@ -567,3 +581,15 @@ TEST_CASE( "Text can be formatted using the Text class", "" ) {
CHECK( Text( "hi there", narrow ).toString() == "hi\nthere" );
}
+
+TEST_CASE( "Long text is truncted", "[Text][Truncated]" ) {
+
+ std::string longLine( 90, '*' );
+
+ std::ostringstream oss;
+ for(int i = 0; i < 600; ++i )
+ oss << longLine << longLine << "\n";
+ Text t( oss.str() );
+ CHECK_THAT( t.toString(), EndsWith( "... message truncated due to excessive size" ) );
+
+}

0 comments on commit aafed30

Please sign in to comment.