Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/projects/SelfTest/TestMain.cpp
diff options
context:
space:
mode:
authorPhil Nash2012-09-15 17:53:27 +0100
committerPhil Nash2012-09-15 17:53:27 +0100
commitfc1baac7f591e7d161fb7f2f30db33da51f94cb6 (patch)
tree295acbb0afb3d74f27a537c7f665d4845f99ebe7 /projects/SelfTest/TestMain.cpp
parentdea756f699f23e2ee23e02099e3989d8897d5194 (diff)
downloadcatch3-fc1baac7f591e7d161fb7f2f30db33da51f94cb6.tar.gz
First cut of tags support
Diffstat (limited to 'projects/SelfTest/TestMain.cpp')
-rw-r--r--projects/SelfTest/TestMain.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/projects/SelfTest/TestMain.cpp b/projects/SelfTest/TestMain.cpp
index 9575cfa1..f745f69b 100644
--- a/projects/SelfTest/TestMain.cpp
+++ b/projects/SelfTest/TestMain.cpp
@@ -330,7 +330,52 @@ TEST_CASE( "selftest/option parsers", "" )
REQUIRE( config.filters.size() == 1 );
REQUIRE( config.filters[0].shouldInclude( makeTestCase( "notIncluded" ) ) == false );
REQUIRE( config.filters[0].shouldInclude( makeTestCase( "test1" ) ) );
+}
+
+TEST_CASE( "selftest/tags", "" ) {
+
+ SECTION( "one tag", "" ) {
+ Catch::TestCaseInfo oneTag( NULL, "test", "[one]", CATCH_INTERNAL_LINEINFO );
+
+ CHECK( oneTag.getDescription() == "" );
+ CHECK( oneTag.hasTag( "one" ) );
+ CHECK( oneTag.tags().size() == 1 );
+ }
+
+ SECTION( "two tags", "" ) {
+ Catch::TestCaseInfo twoTags( NULL, "test", "[one][two]", CATCH_INTERNAL_LINEINFO );
+
+ CHECK( twoTags.getDescription() == "" );
+ CHECK( twoTags.hasTag( "one" ) );
+ CHECK( twoTags.hasTag( "two" ) );
+ CHECK( twoTags.hasTag( "three" ) == false );
+ CHECK( twoTags.tags().size() == 2 );
+ }
+ SECTION( "one tag with characters either side", "" ) {
+ Catch::TestCaseInfo oneTagWithExtras( NULL, "test", "12[one]34", CATCH_INTERNAL_LINEINFO );
+ CHECK( oneTagWithExtras.getDescription() == "1234" );
+ CHECK( oneTagWithExtras.hasTag( "one" ) );
+ CHECK( oneTagWithExtras.hasTag( "two" ) == false );
+ CHECK( oneTagWithExtras.tags().size() == 1 );
+ }
+
+ SECTION( "start of a tag, but not closed", "" ) {
+
+ Catch::TestCaseInfo oneTagOpen( NULL, "test", "[one", CATCH_INTERNAL_LINEINFO );
+
+ CHECK( oneTagOpen.getDescription() == "[one" );
+ CHECK( oneTagOpen.hasTag( "one" ) == false );
+ CHECK( oneTagOpen.tags().size() == 0 );
+ }
+
+ SECTION( "hidden", "" ) {
+ Catch::TestCaseInfo oneTag( NULL, "test", "[hide]", CATCH_INTERNAL_LINEINFO );
+ CHECK( oneTag.getDescription() == "" );
+ CHECK( oneTag.hasTag( "hide" ) );
+ CHECK( oneTag.isHidden() );
+ }
+
}