diff options
| author | Matt Wozniski | 2012-09-26 21:42:44 -0400 |
|---|---|---|
| committer | Matt Wozniski | 2012-09-26 21:42:44 -0400 |
| commit | 07e20aa706abe28d544ae2f8d0f1ba2f855e1e6d (patch) | |
| tree | 8538694d451118cbc7f491977f70d1a5319f7bd6 /projects | |
| parent | f29c898443d65cc3fe2f040e700c64bba907288e (diff) | |
| parent | 67ec8709eae23dfb4fe30f789fd788d5a9c77ea8 (diff) | |
| download | catch3-07e20aa706abe28d544ae2f8d0f1ba2f855e1e6d.tar.gz | |
Merge remote-tracking branch 'phil' into include-guard-fixes
Conflicts:
single_include/catch.hpp
Diffstat (limited to 'projects')
| -rw-r--r-- | projects/SelfTest/MiscTests.cpp | 8 | ||||
| -rw-r--r-- | projects/SelfTest/SurrogateCpps/catch_tags.cpp | 1 | ||||
| -rw-r--r-- | projects/SelfTest/TestMain.cpp | 54 | ||||
| -rw-r--r-- | projects/XCode4/CatchSelfTest/CatchSelfTest.xcodeproj/project.pbxproj | 14 |
4 files changed, 71 insertions, 6 deletions
diff --git a/projects/SelfTest/MiscTests.cpp b/projects/SelfTest/MiscTests.cpp index a60428ee..5b102ffb 100644 --- a/projects/SelfTest/MiscTests.cpp +++ b/projects/SelfTest/MiscTests.cpp @@ -294,7 +294,13 @@ TEST_CASE( "empty", "An empty test with no assertions" ) { } -TEST_CASE( "Nice descriptive name", "[tag1][tag2][hide]" ) +TEST_CASE( "Nice descriptive name", "[tag1][tag2][tag3][hide]" ) { WARN( "This one ran" ); } +TEST_CASE( "first tag", "[tag1]" ) +{ +} +TEST_CASE( "second tag", "[tag2]" ) +{ +} diff --git a/projects/SelfTest/SurrogateCpps/catch_tags.cpp b/projects/SelfTest/SurrogateCpps/catch_tags.cpp new file mode 100644 index 00000000..47664eff --- /dev/null +++ b/projects/SelfTest/SurrogateCpps/catch_tags.cpp @@ -0,0 +1 @@ +#include "catch_tags.hpp" diff --git a/projects/SelfTest/TestMain.cpp b/projects/SelfTest/TestMain.cpp index f745f69b..b0fe11f5 100644 --- a/projects/SelfTest/TestMain.cpp +++ b/projects/SelfTest/TestMain.cpp @@ -247,8 +247,31 @@ TEST_CASE( "selftest/parser/2", "ConfigData" ) { REQUIRE( config.allowThrows == false ); } - } + + SECTION( "streams", "" ) { + SECTION( "-o filename", "" ) { + const char* argv[] = { "test", "-o", "filename.ext" }; + CHECK_NOTHROW( parseIntoConfig( argv, config ) ); + + REQUIRE( config.outputFilename == "filename.ext" ); + REQUIRE( config.stream.empty() ); + } + SECTION( "-o %stdout", "" ) { + const char* argv[] = { "test", "-o", "%stdout" }; + CHECK_NOTHROW( parseIntoConfig( argv, config ) ); + + REQUIRE( config.stream == "stdout" ); + REQUIRE( config.outputFilename.empty() ); + } + SECTION( "--out", "" ) { + const char* argv[] = { "test", "--out", "filename.ext" }; + CHECK_NOTHROW( parseIntoConfig( argv, config ) ); + + REQUIRE( config.outputFilename == "filename.ext" ); + } + } + SECTION( "combinations", "" ) { SECTION( "-a -b", "" ) { const char* argv[] = { "test", "-a", "-b", "-nt" }; @@ -333,13 +356,25 @@ 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 ); CHECK( oneTag.getDescription() == "" ); CHECK( oneTag.hasTag( "one" ) ); - CHECK( oneTag.tags().size() == 1 ); + CHECK( oneTag.getTags().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", "" ) { @@ -349,7 +384,13 @@ TEST_CASE( "selftest/tags", "" ) { CHECK( twoTags.hasTag( "one" ) ); CHECK( twoTags.hasTag( "two" ) ); CHECK( twoTags.hasTag( "three" ) == false ); - CHECK( twoTags.tags().size() == 2 ); + CHECK( twoTags.getTags().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", "" ) { @@ -358,7 +399,7 @@ TEST_CASE( "selftest/tags", "" ) { CHECK( oneTagWithExtras.getDescription() == "1234" ); CHECK( oneTagWithExtras.hasTag( "one" ) ); CHECK( oneTagWithExtras.hasTag( "two" ) == false ); - CHECK( oneTagWithExtras.tags().size() == 1 ); + CHECK( oneTagWithExtras.getTags().size() == 1 ); } SECTION( "start of a tag, but not closed", "" ) { @@ -367,7 +408,7 @@ TEST_CASE( "selftest/tags", "" ) { CHECK( oneTagOpen.getDescription() == "[one" ); CHECK( oneTagOpen.hasTag( "one" ) == false ); - CHECK( oneTagOpen.tags().size() == 0 ); + CHECK( oneTagOpen.getTags().size() == 0 ); } SECTION( "hidden", "" ) { @@ -376,6 +417,9 @@ TEST_CASE( "selftest/tags", "" ) { CHECK( oneTag.getDescription() == "" ); CHECK( oneTag.hasTag( "hide" ) ); CHECK( oneTag.isHidden() ); + + CHECK( oneTag.matchesTags( "~[hide]" ) == false ); + } } diff --git a/projects/XCode4/CatchSelfTest/CatchSelfTest.xcodeproj/project.pbxproj b/projects/XCode4/CatchSelfTest/CatchSelfTest.xcodeproj/project.pbxproj index 0e2795e9..c851d77f 100644 --- a/projects/XCode4/CatchSelfTest/CatchSelfTest.xcodeproj/project.pbxproj +++ b/projects/XCode4/CatchSelfTest/CatchSelfTest.xcodeproj/project.pbxproj @@ -17,6 +17,7 @@ 4A6D0C3D149B3D9E00DB3EAA /* MiscTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A6D0C34149B3D9E00DB3EAA /* MiscTests.cpp */; }; 4A6D0C3E149B3D9E00DB3EAA /* TestMain.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A6D0C35149B3D9E00DB3EAA /* TestMain.cpp */; }; 4A6D0C3F149B3D9E00DB3EAA /* TrickyTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A6D0C36149B3D9E00DB3EAA /* TrickyTests.cpp */; }; + 4A8E4DD2160A352200194CBD /* catch_tags.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A8E4DD0160A352200194CBD /* catch_tags.cpp */; }; 4AA7FF4315F3E89E009AD7F9 /* BDDTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4AA7FF4115F3E89D009AD7F9 /* BDDTests.cpp */; }; 4AE1840B14EE4F230066340D /* catch_self_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4AE1840A14EE4F230066340D /* catch_self_test.cpp */; }; /* End PBXBuildFile section */ @@ -93,6 +94,8 @@ 4A6D0C67149B3E3D00DB3EAA /* catch_reporter_junit.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = catch_reporter_junit.hpp; sourceTree = "<group>"; }; 4A6D0C68149B3E3D00DB3EAA /* catch_reporter_xml.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = catch_reporter_xml.hpp; sourceTree = "<group>"; }; 4A7ADB4314F631E10094FE10 /* catch_totals.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = catch_totals.hpp; sourceTree = "<group>"; }; + 4A8E4DCC160A344100194CBD /* catch_tags.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = catch_tags.hpp; sourceTree = "<group>"; }; + 4A8E4DD0160A352200194CBD /* catch_tags.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = catch_tags.cpp; path = ../../../SelfTest/SurrogateCpps/catch_tags.cpp; sourceTree = "<group>"; }; 4A90B59B15D0F61A00EF71BC /* catch_interfaces_generators.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = catch_interfaces_generators.h; sourceTree = "<group>"; }; 4A90B59D15D24FE900EF71BC /* catch_resultinfo.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = catch_resultinfo.hpp; sourceTree = "<group>"; }; 4A90B59E15D2521E00EF71BC /* catch_resultinfo_builder.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = catch_resultinfo_builder.hpp; sourceTree = "<group>"; }; @@ -170,6 +173,7 @@ 4A6D0C41149B3DE900DB3EAA /* Catch */ = { isa = PBXGroup; children = ( + 4A8E4DCF160A34E200194CBD /* SurrogateCpps */, 4A6D0C44149B3E1500DB3EAA /* catch.hpp */, 4A6D0C42149B3E1500DB3EAA /* catch_runner.hpp */, 4A6D0C43149B3E1500DB3EAA /* catch_with_main.hpp */, @@ -206,6 +210,14 @@ path = ../../../../include/reporters; sourceTree = "<group>"; }; + 4A8E4DCF160A34E200194CBD /* SurrogateCpps */ = { + isa = PBXGroup; + children = ( + 4A8E4DD0160A352200194CBD /* catch_tags.cpp */, + ); + name = SurrogateCpps; + sourceTree = "<group>"; + }; 4AC91CB4155B9EBF00DC5117 /* impl */ = { isa = PBXGroup; children = ( @@ -265,6 +277,7 @@ 4AB77CB71553B72B00857BF0 /* catch_section_info.hpp */, 4AB77CB81553BB3800857BF0 /* catch_running_test.hpp */, 4A084F1D15DAD15F0027E631 /* catch_test_spec.h */, + 4A8E4DCC160A344100194CBD /* catch_tags.hpp */, ); name = "Test execution"; sourceTree = "<group>"; @@ -377,6 +390,7 @@ 4A6D0C3F149B3D9E00DB3EAA /* TrickyTests.cpp in Sources */, 4AE1840B14EE4F230066340D /* catch_self_test.cpp in Sources */, 4AA7FF4315F3E89E009AD7F9 /* BDDTests.cpp in Sources */, + 4A8E4DD2160A352200194CBD /* catch_tags.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; |