diff options
| author | Phil Nash | 2012-09-21 07:48:03 +0100 |
|---|---|---|
| committer | Phil Nash | 2012-09-21 07:48:03 +0100 |
| commit | 85c0e3d42b060f521af14698ce53ada3c6753f8a (patch) | |
| tree | 2c247627f293fff6027c8f4b7538bf25f8a4871b /projects/SelfTest/TestMain.cpp | |
| parent | 9d8570ff80f70aba53fba3302ac7e232d49b7350 (diff) | |
| download | catch3-85c0e3d42b060f521af14698ce53ada3c6753f8a.tar.gz | |
Tag command line parsing implementation
Diffstat (limited to 'projects/SelfTest/TestMain.cpp')
| -rw-r--r-- | projects/SelfTest/TestMain.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/projects/SelfTest/TestMain.cpp b/projects/SelfTest/TestMain.cpp index f745f69b..2c0c2514 100644 --- a/projects/SelfTest/TestMain.cpp +++ b/projects/SelfTest/TestMain.cpp @@ -333,6 +333,12 @@ TEST_CASE( "selftest/option parsers", "" ) } TEST_CASE( "selftest/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]~[hide],[three]"; SECTION( "one tag", "" ) { Catch::TestCaseInfo oneTag( NULL, "test", "[one]", CATCH_INTERNAL_LINEINFO ); @@ -340,6 +346,12 @@ TEST_CASE( "selftest/tags", "" ) { CHECK( oneTag.getDescription() == "" ); CHECK( oneTag.hasTag( "one" ) ); CHECK( oneTag.tags().size() == 1 ); + + CHECK( oneTag.matchesTags( p1 ) == true ); + CHECK( oneTag.matchesTags( p2 ) == true ); + CHECK( oneTag.matchesTags( p3 ) == false ); + CHECK( oneTag.matchesTags( p4 ) == false ); + CHECK( oneTag.matchesTags( p5 ) == false ); } SECTION( "two tags", "" ) { @@ -350,6 +362,12 @@ TEST_CASE( "selftest/tags", "" ) { CHECK( twoTags.hasTag( "two" ) ); CHECK( twoTags.hasTag( "three" ) == false ); CHECK( twoTags.tags().size() == 2 ); + + CHECK( twoTags.matchesTags( p1 ) == true ); + CHECK( twoTags.matchesTags( p2 ) == true ); + CHECK( twoTags.matchesTags( p3 ) == true ); + CHECK( twoTags.matchesTags( p4 ) == true ); + CHECK( twoTags.matchesTags( p5 ) == true ); } SECTION( "one tag with characters either side", "" ) { @@ -376,6 +394,9 @@ TEST_CASE( "selftest/tags", "" ) { CHECK( oneTag.getDescription() == "" ); CHECK( oneTag.hasTag( "hide" ) ); CHECK( oneTag.isHidden() ); + + CHECK( oneTag.matchesTags( "~[hide]" ) == false ); + } } |