diff --git a/include/internal/catch_run_context.cpp b/include/internal/catch_run_context.cpp index 97700bef..73558521 100644 --- a/include/internal/catch_run_context.cpp +++ b/include/internal/catch_run_context.cpp @@ -208,7 +208,7 @@ namespace Catch { // Recreate section for test case (as we will lose the one that was in scope) auto const& testCaseInfo = m_activeTestCase->getTestCaseInfo(); - SectionInfo testCaseSection(testCaseInfo.lineInfo, testCaseInfo.name, testCaseInfo.description); + SectionInfo testCaseSection(testCaseInfo.lineInfo, testCaseInfo.name); Counts assertions; assertions.failed = 1; @@ -246,7 +246,7 @@ namespace Catch { void RunContext::runCurrentTest(std::string & redirectedCout, std::string & redirectedCerr) { auto const& testCaseInfo = m_activeTestCase->getTestCaseInfo(); - SectionInfo testCaseSection(testCaseInfo.lineInfo, testCaseInfo.name, testCaseInfo.description); + SectionInfo testCaseSection(testCaseInfo.lineInfo, testCaseInfo.name); m_reporter->sectionStarting(testCaseSection); Counts prevAssertions = m_totals.assertions; double duration = 0; diff --git a/include/internal/catch_section.cpp b/include/internal/catch_section.cpp index 72a57d51..0646d36f 100644 --- a/include/internal/catch_section.cpp +++ b/include/internal/catch_section.cpp @@ -21,7 +21,7 @@ namespace Catch { Section::~Section() { if( m_sectionIncluded ) { - SectionEndInfo endInfo( m_info, m_assertions, m_timer.getElapsedSeconds() ); + SectionEndInfo endInfo{ m_info, m_assertions, m_timer.getElapsedSeconds() }; if( uncaught_exceptions() ) getResultCapture().sectionEndedEarly( endInfo ); else diff --git a/include/internal/catch_section.h b/include/internal/catch_section.h index 1e5b1c3c..f02a2b43 100644 --- a/include/internal/catch_section.h +++ b/include/internal/catch_section.h @@ -35,7 +35,7 @@ namespace Catch { } // end namespace Catch - #define INTERNAL_CATCH_SECTION( ... ) \ - if( Catch::Section const& INTERNAL_CATCH_UNIQUE_NAME( catch_internal_Section ) = Catch::SectionInfo( CATCH_INTERNAL_LINEINFO, __VA_ARGS__ ) ) +#define INTERNAL_CATCH_SECTION( ... ) \ + if( Catch::Section const& INTERNAL_CATCH_UNIQUE_NAME( catch_internal_Section ) = Catch::SectionInfo( CATCH_INTERNAL_LINEINFO, __VA_ARGS__ ) ) #endif // TWOBLUECUBES_CATCH_SECTION_H_INCLUDED diff --git a/include/internal/catch_section_info.cpp b/include/internal/catch_section_info.cpp index e2846b8a..89714e35 100644 --- a/include/internal/catch_section_info.cpp +++ b/include/internal/catch_section_info.cpp @@ -11,15 +11,9 @@ namespace Catch { SectionInfo::SectionInfo ( SourceLineInfo const& _lineInfo, - std::string const& _name, - std::string const& _description ) + std::string const& _name ) : name( _name ), - description( _description ), lineInfo( _lineInfo ) {} - SectionEndInfo::SectionEndInfo( SectionInfo const& _sectionInfo, Counts const& _prevAssertions, double _durationInSeconds ) - : sectionInfo( _sectionInfo ), prevAssertions( _prevAssertions ), durationInSeconds( _durationInSeconds ) - {} - } // end namespace Catch diff --git a/include/internal/catch_section_info.h b/include/internal/catch_section_info.h index 86681ba7..832ed7d9 100644 --- a/include/internal/catch_section_info.h +++ b/include/internal/catch_section_info.h @@ -16,19 +16,21 @@ namespace Catch { struct SectionInfo { + SectionInfo + ( SourceLineInfo const& _lineInfo, + std::string const& _name ); + + // Deprecated SectionInfo ( SourceLineInfo const& _lineInfo, std::string const& _name, - std::string const& _description = std::string() ); + std::string const& ) : SectionInfo( _lineInfo, _name ) {} std::string name; - std::string description; SourceLineInfo lineInfo; }; struct SectionEndInfo { - SectionEndInfo( SectionInfo const& _sectionInfo, Counts const& _prevAssertions, double _durationInSeconds ); - SectionInfo sectionInfo; Counts prevAssertions; double durationInSeconds; diff --git a/include/internal/catch_test_case_tracker.cpp b/include/internal/catch_test_case_tracker.cpp index 8502b405..c6759438 100644 --- a/include/internal/catch_test_case_tracker.cpp +++ b/include/internal/catch_test_case_tracker.cpp @@ -73,8 +73,8 @@ namespace TestCaseTracking { TrackerBase::TrackerHasName::TrackerHasName( NameAndLocation const& nameAndLocation ) : m_nameAndLocation( nameAndLocation ) {} bool TrackerBase::TrackerHasName::operator ()( ITrackerPtr const& tracker ) const { return - tracker->nameAndLocation().name == m_nameAndLocation.name && - tracker->nameAndLocation().location == m_nameAndLocation.location; + tracker->nameAndLocation().location == m_nameAndLocation.location && + tracker->nameAndLocation().name == m_nameAndLocation.name; } TrackerBase::TrackerBase( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ) diff --git a/include/reporters/catch_reporter_xml.cpp b/include/reporters/catch_reporter_xml.cpp index b721d449..b6c7d052 100644 --- a/include/reporters/catch_reporter_xml.cpp +++ b/include/reporters/catch_reporter_xml.cpp @@ -80,8 +80,7 @@ namespace Catch { StreamingReporterBase::sectionStarting( sectionInfo ); if( m_sectionDepth++ > 0 ) { m_xml.startElement( "Section" ) - .writeAttribute( "name", trim( sectionInfo.name ) ) - .writeAttribute( "description", sectionInfo.description ); + .writeAttribute( "name", trim( sectionInfo.name ) ); writeSourceInfo( sectionInfo.lineInfo ); m_xml.ensureTagClosed(); } diff --git a/projects/SelfTest/Baselines/compact.sw.approved.txt b/projects/SelfTest/Baselines/compact.sw.approved.txt index 24d9b1b7..89db0837 100644 --- a/projects/SelfTest/Baselines/compact.sw.approved.txt +++ b/projects/SelfTest/Baselines/compact.sw.approved.txt @@ -988,6 +988,15 @@ Misc.tests.cpp:: passed: l == std::numeric_limits::max() == 9223372036854775807 (0x) Misc.tests.cpp:: failed: b > a for: 0 > 1 +Misc.tests.cpp:: failed: b > a for: 1 > 1 +Misc.tests.cpp:: passed: b > a for: 2 > 1 +Misc.tests.cpp:: passed: b > a for: 3 > 1 +Misc.tests.cpp:: passed: b > a for: 4 > 1 +Misc.tests.cpp:: passed: b > a for: 5 > 1 +Misc.tests.cpp:: passed: b > a for: 6 > 1 +Misc.tests.cpp:: passed: b > a for: 7 > 1 +Misc.tests.cpp:: passed: b > a for: 8 > 1 +Misc.tests.cpp:: passed: b > a for: 9 > 1 Misc.tests.cpp:: failed: ( fib[i] % 2 ) == 0 for: 1 == 0 with 1 message: 'Testing if fib[0] (1) is even' Misc.tests.cpp:: failed: ( fib[i] % 2 ) == 0 for: 1 == 0 with 1 message: 'Testing if fib[1] (1) is even' Misc.tests.cpp:: passed: ( fib[i] % 2 ) == 0 for: 0 == 0 with 1 message: 'Testing if fib[2] (2) is even' @@ -1144,5 +1153,5 @@ Misc.tests.cpp:: passed: v.size() == 5 for: 5 == 5 Misc.tests.cpp:: passed: v.capacity() >= 5 for: 5 >= 5 Misc.tests.cpp:: passed: Misc.tests.cpp:: passed: -Failed 62 test cases, failed 121 assertions. +Failed 62 test cases, failed 122 assertions. diff --git a/projects/SelfTest/Baselines/console.std.approved.txt b/projects/SelfTest/Baselines/console.std.approved.txt index 1992fb9f..4a2554c2 100644 --- a/projects/SelfTest/Baselines/console.std.approved.txt +++ b/projects/SelfTest/Baselines/console.std.approved.txt @@ -968,7 +968,7 @@ explicitly with message: ------------------------------------------------------------------------------- looped SECTION tests - s1 + b is currently: 0 ------------------------------------------------------------------------------- Misc.tests.cpp: ............................................................................... @@ -978,6 +978,18 @@ Misc.tests.cpp:: FAILED: with expansion: 0 > 1 +------------------------------------------------------------------------------- +looped SECTION tests + b is currently: 1 +------------------------------------------------------------------------------- +Misc.tests.cpp: +............................................................................... + +Misc.tests.cpp:: FAILED: + CHECK( b > a ) +with expansion: + 1 > 1 + ------------------------------------------------------------------------------- looped tests ------------------------------------------------------------------------------- @@ -1028,8 +1040,8 @@ with message: ------------------------------------------------------------------------------- more nested SECTION tests - s1 - s2 + doesn't equal + equal ------------------------------------------------------------------------------- Misc.tests.cpp: ............................................................................... @@ -1085,5 +1097,5 @@ due to unexpected exception with message: =============================================================================== test cases: 208 | 155 passed | 49 failed | 4 failed as expected -assertions: 1065 | 937 passed | 107 failed | 21 failed as expected +assertions: 1074 | 945 passed | 108 failed | 21 failed as expected diff --git a/projects/SelfTest/Baselines/console.sw.approved.txt b/projects/SelfTest/Baselines/console.sw.approved.txt index 047c7163..161fa23f 100644 --- a/projects/SelfTest/Baselines/console.sw.approved.txt +++ b/projects/SelfTest/Baselines/console.sw.approved.txt @@ -4130,7 +4130,7 @@ with expansion: ------------------------------------------------------------------------------- Process can be configured on command line test lists - 1 test + Specify one test case using ------------------------------------------------------------------------------- CmdLine.tests.cpp: ............................................................................... @@ -7754,7 +7754,7 @@ with expansion: ------------------------------------------------------------------------------- looped SECTION tests - s1 + b is currently: 0 ------------------------------------------------------------------------------- Misc.tests.cpp: ............................................................................... @@ -7764,6 +7764,122 @@ Misc.tests.cpp:: FAILED: with expansion: 0 > 1 +------------------------------------------------------------------------------- +looped SECTION tests + b is currently: 1 +------------------------------------------------------------------------------- +Misc.tests.cpp: +............................................................................... + +Misc.tests.cpp:: FAILED: + CHECK( b > a ) +with expansion: + 1 > 1 + +------------------------------------------------------------------------------- +looped SECTION tests + b is currently: 2 +------------------------------------------------------------------------------- +Misc.tests.cpp: +............................................................................... + +Misc.tests.cpp:: +PASSED: + CHECK( b > a ) +with expansion: + 2 > 1 + +------------------------------------------------------------------------------- +looped SECTION tests + b is currently: 3 +------------------------------------------------------------------------------- +Misc.tests.cpp: +............................................................................... + +Misc.tests.cpp:: +PASSED: + CHECK( b > a ) +with expansion: + 3 > 1 + +------------------------------------------------------------------------------- +looped SECTION tests + b is currently: 4 +------------------------------------------------------------------------------- +Misc.tests.cpp: +............................................................................... + +Misc.tests.cpp:: +PASSED: + CHECK( b > a ) +with expansion: + 4 > 1 + +------------------------------------------------------------------------------- +looped SECTION tests + b is currently: 5 +------------------------------------------------------------------------------- +Misc.tests.cpp: +............................................................................... + +Misc.tests.cpp:: +PASSED: + CHECK( b > a ) +with expansion: + 5 > 1 + +------------------------------------------------------------------------------- +looped SECTION tests + b is currently: 6 +------------------------------------------------------------------------------- +Misc.tests.cpp: +............................................................................... + +Misc.tests.cpp:: +PASSED: + CHECK( b > a ) +with expansion: + 6 > 1 + +------------------------------------------------------------------------------- +looped SECTION tests + b is currently: 7 +------------------------------------------------------------------------------- +Misc.tests.cpp: +............................................................................... + +Misc.tests.cpp:: +PASSED: + CHECK( b > a ) +with expansion: + 7 > 1 + +------------------------------------------------------------------------------- +looped SECTION tests + b is currently: 8 +------------------------------------------------------------------------------- +Misc.tests.cpp: +............................................................................... + +Misc.tests.cpp:: +PASSED: + CHECK( b > a ) +with expansion: + 8 > 1 + +------------------------------------------------------------------------------- +looped SECTION tests + b is currently: 9 +------------------------------------------------------------------------------- +Misc.tests.cpp: +............................................................................... + +Misc.tests.cpp:: +PASSED: + CHECK( b > a ) +with expansion: + 9 > 1 + ------------------------------------------------------------------------------- looped tests ------------------------------------------------------------------------------- @@ -7830,8 +7946,8 @@ with message: ------------------------------------------------------------------------------- more nested SECTION tests - s1 - s2 + doesn't equal + equal ------------------------------------------------------------------------------- Misc.tests.cpp: ............................................................................... @@ -7843,8 +7959,8 @@ with expansion: ------------------------------------------------------------------------------- more nested SECTION tests - s1 - s3 + doesn't equal + not equal ------------------------------------------------------------------------------- Misc.tests.cpp: ............................................................................... @@ -7857,8 +7973,8 @@ with expansion: ------------------------------------------------------------------------------- more nested SECTION tests - s1 - s4 + doesn't equal + less than ------------------------------------------------------------------------------- Misc.tests.cpp: ............................................................................... @@ -7871,7 +7987,7 @@ with expansion: ------------------------------------------------------------------------------- nested SECTION tests - s1 + doesn't equal ------------------------------------------------------------------------------- Misc.tests.cpp: ............................................................................... @@ -7890,8 +8006,8 @@ with expansion: ------------------------------------------------------------------------------- nested SECTION tests - s1 - s2 + doesn't equal + not equal ------------------------------------------------------------------------------- Misc.tests.cpp: ............................................................................... @@ -7993,7 +8109,7 @@ with expansion: ------------------------------------------------------------------------------- random SECTION tests - s1 + doesn't equal ------------------------------------------------------------------------------- Misc.tests.cpp: ............................................................................... @@ -8012,7 +8128,7 @@ with expansion: ------------------------------------------------------------------------------- random SECTION tests - s2 + not equal ------------------------------------------------------------------------------- Misc.tests.cpp: ............................................................................... @@ -8973,7 +9089,9 @@ with expansion: ------------------------------------------------------------------------------- xmlentitycheck - embedded xml + embedded xml: it should be possible to embed xml characters, such as <, + " or &, or even whole documents within an attribute + ------------------------------------------------------------------------------- Misc.tests.cpp: ............................................................................... @@ -8983,7 +9101,7 @@ PASSED: ------------------------------------------------------------------------------- xmlentitycheck - encoded chars + encoded chars: these should all be encoded: &&&"""<<<&"<<&" ------------------------------------------------------------------------------- Misc.tests.cpp: ............................................................................... @@ -8993,5 +9111,5 @@ PASSED: =============================================================================== test cases: 208 | 142 passed | 62 failed | 4 failed as expected -assertions: 1079 | 937 passed | 121 failed | 21 failed as expected +assertions: 1088 | 945 passed | 122 failed | 21 failed as expected diff --git a/projects/SelfTest/Baselines/junit.sw.approved.txt b/projects/SelfTest/Baselines/junit.sw.approved.txt index 62ca9094..8dd50adf 100644 --- a/projects/SelfTest/Baselines/junit.sw.approved.txt +++ b/projects/SelfTest/Baselines/junit.sw.approved.txt @@ -1,7 +1,7 @@ - + @@ -471,7 +471,7 @@ Message.tests.cpp: - + @@ -750,11 +750,24 @@ Message.tests.cpp: - + Misc.tests.cpp: + + +Misc.tests.cpp: + + + + + + + + + + Testing if fib[0] (1) is even @@ -781,15 +794,15 @@ Testing if fib[7] (21) is even Misc.tests.cpp: - + Misc.tests.cpp: - - - - + + + + @@ -797,8 +810,8 @@ Misc.tests.cpp: - - + + @@ -873,8 +886,8 @@ Exception.tests.cpp: - - + + A string sent directly to stdout Message from section one diff --git a/projects/SelfTest/Baselines/xml.sw.approved.txt b/projects/SelfTest/Baselines/xml.sw.approved.txt index 5452f2fa..43534b18 100644 --- a/projects/SelfTest/Baselines/xml.sw.approved.txt +++ b/projects/SelfTest/Baselines/xml.sw.approved.txt @@ -4808,7 +4808,7 @@
-
+
result @@ -8691,7 +8691,7 @@ loose text artifact -
+
b > a @@ -8702,6 +8702,105 @@ loose text artifact
+
+ + + b > a + + + 1 > 1 + + + +
+
+ + + b > a + + + 2 > 1 + + + +
+
+ + + b > a + + + 3 > 1 + + + +
+
+ + + b > a + + + 4 > 1 + + + +
+
+ + + b > a + + + 5 > 1 + + + +
+
+ + + b > a + + + 6 > 1 + + + +
+
+ + + b > a + + + 7 > 1 + + + +
+
+ + + b > a + + + 8 > 1 + + + +
+
+ + + b > a + + + 9 > 1 + + + +
@@ -8796,8 +8895,8 @@ loose text artifact -
-
+
+
a == b @@ -8810,8 +8909,8 @@ loose text artifact
-
-
+
+
a != b @@ -8824,8 +8923,8 @@ loose text artifact
-
-
+
+
a < b @@ -8841,7 +8940,7 @@ loose text artifact -
+
a != b @@ -8858,7 +8957,7 @@ loose text artifact 2 != 1 -
+
a != b @@ -8953,7 +9052,7 @@ loose text artifact -
+
a != b @@ -8972,7 +9071,7 @@ loose text artifact
-
+
a != b @@ -9928,15 +10027,15 @@ loose text artifact -
+
-
+
- + - + diff --git a/projects/SelfTest/IntrospectiveTests/CmdLine.tests.cpp b/projects/SelfTest/IntrospectiveTests/CmdLine.tests.cpp index 1da3fa08..cb635ead 100644 --- a/projects/SelfTest/IntrospectiveTests/CmdLine.tests.cpp +++ b/projects/SelfTest/IntrospectiveTests/CmdLine.tests.cpp @@ -295,7 +295,7 @@ TEST_CASE( "Process can be configured on command line", "[config][command-line]" } SECTION("test lists") { - SECTION("1 test", "Specify one test case using") { + SECTION("Specify one test case using") { auto result = cli.parse({"test", "test1"}); CHECK(result); diff --git a/projects/SelfTest/UsageTests/Misc.tests.cpp b/projects/SelfTest/UsageTests/Misc.tests.cpp index e5059e9f..09498a6e 100644 --- a/projects/SelfTest/UsageTests/Misc.tests.cpp +++ b/projects/SelfTest/UsageTests/Misc.tests.cpp @@ -67,12 +67,12 @@ TEST_CASE( "random SECTION tests", "[.][sections][failing]" ) { int a = 1; int b = 2; - SECTION( "s1", "doesn't equal" ) { + SECTION( "doesn't equal" ) { REQUIRE( a != b ); REQUIRE( b != a ); } - SECTION( "s2", "not equal" ) { + SECTION( "not equal" ) { REQUIRE( a != b); } } @@ -81,11 +81,11 @@ TEST_CASE( "nested SECTION tests", "[.][sections][failing]" ) { int a = 1; int b = 2; - SECTION( "s1", "doesn't equal" ) { + SECTION( "doesn't equal" ) { REQUIRE( a != b ); REQUIRE( b != a ); - SECTION( "s2", "not equal" ) { + SECTION( "not equal" ) { REQUIRE( a != b); } } @@ -95,15 +95,15 @@ TEST_CASE( "more nested SECTION tests", "[sections][failing][.]" ) { int a = 1; int b = 2; - SECTION( "s1", "doesn't equal" ) { - SECTION( "s2", "equal" ) { + SECTION( "doesn't equal" ) { + SECTION( "equal" ) { REQUIRE( a == b ); } - SECTION( "s3", "not equal" ) { + SECTION( "not equal" ) { REQUIRE( a != b ); } - SECTION( "s4", "less than" ) { + SECTION( "less than" ) { REQUIRE( a < b ); } } @@ -112,16 +112,16 @@ TEST_CASE( "more nested SECTION tests", "[sections][failing][.]" ) { TEST_CASE( "even more nested SECTION tests", "[sections]" ) { SECTION( "c" ) { SECTION( "d (leaf)" ) { - SUCCEED(""); // avoid failing due to no tests + SUCCEED(); // avoid failing due to no tests } SECTION( "e (leaf)" ) { - SUCCEED(""); // avoid failing due to no tests + SUCCEED(); // avoid failing due to no tests } } SECTION( "f (leaf)" ) { - SUCCEED(""); // avoid failing due to no tests + SUCCEED(); // avoid failing due to no tests } } @@ -131,7 +131,7 @@ TEST_CASE( "looped SECTION tests", "[.][failing][sections]" ) { for( int b = 0; b < 10; ++b ) { std::ostringstream oss; oss << "b is currently: " << b; - SECTION( "s1", oss.str() ) { + SECTION( oss.str() ) { CHECK( b > a ); } } @@ -174,11 +174,11 @@ TEST_CASE( "checkedElse, failing", "[failing][.]" ) { } TEST_CASE( "xmlentitycheck" ) { - SECTION( "embedded xml", "it should be possible to embed xml characters, such as <, \" or &, or even whole documents within an attribute" ) { - SUCCEED(""); // We need this here to stop it failing due to no tests + SECTION( "embedded xml: it should be possible to embed xml characters, such as <, \" or &, or even whole documents within an attribute" ) { + SUCCEED(); // We need this here to stop it failing due to no tests } - SECTION( "encoded chars", "these should all be encoded: &&&\"\"\"<<<&\"<<&\"" ) { - SUCCEED(""); // We need this here to stop it failing due to no tests + SECTION( "encoded chars: these should all be encoded: &&&\"\"\"<<<&\"<<&\"" ) { + SUCCEED(); // We need this here to stop it failing due to no tests } } @@ -265,8 +265,8 @@ TEST_CASE( "vectors can be sized and resized", "[vector]" ) { // https://github.com/philsquared/Catch/issues/166 TEST_CASE("A couple of nested sections followed by a failure", "[failing][.]") { - SECTION("Outer", "") - SECTION("Inner", "") + SECTION("Outer") + SECTION("Inner") SUCCEED("that's not flying - that's failing in style"); FAIL("to infinity and beyond"); @@ -274,7 +274,7 @@ TEST_CASE("A couple of nested sections followed by a failure", "[failing][.]") { TEST_CASE("not allowed", "[!throws]") { // This test case should not be included if you run with -e on the command line - SUCCEED( "" ); + SUCCEED(); } //TEST_CASE( "Is big endian" ) { diff --git a/projects/SelfTest/UsageTests/Tricky.tests.cpp b/projects/SelfTest/UsageTests/Tricky.tests.cpp index 1c352ce9..180ad00e 100644 --- a/projects/SelfTest/UsageTests/Tricky.tests.cpp +++ b/projects/SelfTest/UsageTests/Tricky.tests.cpp @@ -232,28 +232,28 @@ struct is_true TEST_CASE( "(unimplemented) static bools can be evaluated", "[Tricky]" ) { - SECTION("compare to true","") + SECTION("compare to true") { REQUIRE( is_true::value == true ); REQUIRE( true == is_true::value ); } - SECTION("compare to false","") + SECTION("compare to false") { REQUIRE( is_true::value == false ); REQUIRE( false == is_true::value ); } - SECTION("negation", "") + SECTION("negation") { REQUIRE( !is_true::value ); } - SECTION("double negation","") + SECTION("double negation") { REQUIRE( !!is_true::value ); } - SECTION("direct","") + SECTION("direct") { REQUIRE( is_true::value ); REQUIRE_FALSE( is_true::value );