Progmasoft Git

catch3

Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.

Clonegit clone https://git.progmasoft.com/catch3

Added an extra tag test

Commit
aafed303bb72d2aa40a3513e714c4c8ad9146c19
Author
Phil Nash ·
Parents
34266b6e0fee

Files · Download .tar.gz

Changes

 projects/SelfTest/TestMain.cpp | 30 ++++++++++++++++++++++++++++--
 1 file changed, 28 insertions(+), 2 deletions(-)

diff --git a/projects/SelfTest/TestMain.cpp b/projects/SelfTest/TestMain.cpp
index aae3f53b..dc2684ed 100644
--- a/projects/SelfTest/TestMain.cpp
+++ b/projects/SelfTest/TestMain.cpp
@@ -298,7 +298,7 @@ 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]";
@@ -306,7 +306,7 @@ TEST_CASE( "selftest/tags", "" ) {
     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" ) );
+    
+}