mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-22 13:26:10 +01:00
Added an extra tag test
This commit is contained in:
parent
34266b6e0f
commit
aafed303bb
@ -298,7 +298,7 @@ int getArgc( const char * (&)[size] ) {
|
|||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE( "selftest/tags", "" ) {
|
TEST_CASE( "selftest/tags", "[tags]" ) {
|
||||||
|
|
||||||
std::string p1 = "[one]";
|
std::string p1 = "[one]";
|
||||||
std::string p2 = "[one],[two]";
|
std::string p2 = "[one],[two]";
|
||||||
@ -306,7 +306,7 @@ TEST_CASE( "selftest/tags", "" ) {
|
|||||||
std::string p4 = "[one][two],[three]";
|
std::string p4 = "[one][two],[three]";
|
||||||
std::string p5 = "[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 );
|
Catch::TestCase oneTag = makeTestCase( NULL, "", "test", "[one]", CATCH_INTERNAL_LINEINFO );
|
||||||
|
|
||||||
CHECK( oneTag.getTestCaseInfo().description == "" );
|
CHECK( oneTag.getTestCaseInfo().description == "" );
|
||||||
@ -320,6 +320,20 @@ TEST_CASE( "selftest/tags", "" ) {
|
|||||||
CHECK( oneTag.matchesTags( p5 ) == false );
|
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", "" ) {
|
SECTION( "two tags", "" ) {
|
||||||
Catch::TestCase twoTags= makeTestCase( NULL, "", "test", "[one][two]", CATCH_INTERNAL_LINEINFO );
|
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" );
|
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" ) );
|
||||||
|
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user