catch3
Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.
Clonegit clone https://git.progmasoft.com/catch3
Deprecated description in SECTION (still accepts it, for now, but doesn't use it anywhere)
- Commit
1579744dddc69c290808eae0b9c6887ee60765f2- Author
- Phil Nash ·
- Parents
9b0e740e3117
Changes
include/internal/catch_run_context.cpp | 4 +- include/internal/catch_section.cpp | 2 +- include/internal/catch_section.h | 4 +- include/internal/catch_section_info.cpp | 8 +- include/internal/catch_section_info.h | 10 +- include/internal/catch_test_case_tracker.cpp | 4 +- include/reporters/catch_reporter_xml.cpp | 3 +- .../SelfTest/Baselines/compact.sw.approved.txt | 11 +- .../SelfTest/Baselines/console.std.approved.txt | 20 ++- .../SelfTest/Baselines/console.sw.approved.txt | 150 ++++++++++++++++++--- projects/SelfTest/Baselines/junit.sw.approved.txt | 37 +++-- projects/SelfTest/Baselines/xml.sw.approved.txt | 131 +++++++++++++++--- .../SelfTest/IntrospectiveTests/CmdLine.tests.cpp | 2 +- projects/SelfTest/UsageTests/Misc.tests.cpp | 38 +++--- projects/SelfTest/UsageTests/Tricky.tests.cpp | 10 +- 15 files changed, 340 insertions(+), 94 deletions(-) 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:<line number>: passed: l == std::numeric_limits<long long>::max() == 9223372036854775807 (0x<hex digits>) Misc.tests.cpp:<line number>: failed: b > a for: 0 > 1 +Misc.tests.cpp:<line number>: failed: b > a for: 1 > 1 +Misc.tests.cpp:<line number>: passed: b > a for: 2 > 1 +Misc.tests.cpp:<line number>: passed: b > a for: 3 > 1 +Misc.tests.cpp:<line number>: passed: b > a for: 4 > 1 +Misc.tests.cpp:<line number>: passed: b > a for: 5 > 1 +Misc.tests.cpp:<line number>: passed: b > a for: 6 > 1 +Misc.tests.cpp:<line number>: passed: b > a for: 7 > 1 +Misc.tests.cpp:<line number>: passed: b > a for: 8 > 1 +Misc.tests.cpp:<line number>: passed: b > a for: 9 > 1 Misc.tests.cpp:<line number>: failed: ( fib[i] % 2 ) == 0 for: 1 == 0 with 1 message: 'Testing if fib[0] (1) is even' Misc.tests.cpp:<line number>: failed: ( fib[i] % 2 ) == 0 for: 1 == 0 with 1 message: 'Testing if fib[1] (1) is even' Misc.tests.cpp:<line number>: 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:<line number>: passed: v.size() == 5 for: 5 == 5 Misc.tests.cpp:<line number>: passed: v.capacity() >= 5 for: 5 >= 5 Misc.tests.cpp:<line number>: passed: Misc.tests.cpp:<line number>: 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:<line number> ............................................................................... @@ -978,6 +978,18 @@ Misc.tests.cpp:<line number>: FAILED: with expansion: 0 > 1 +------------------------------------------------------------------------------- +looped SECTION tests + b is currently: 1 +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: 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:<line number> ............................................................................... @@ -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:<line number> ............................................................................... @@ -7754,7 +7754,7 @@ with expansion: ------------------------------------------------------------------------------- looped SECTION tests - s1 + b is currently: 0 ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... @@ -7764,6 +7764,122 @@ Misc.tests.cpp:<line number>: FAILED: with expansion: 0 > 1 +------------------------------------------------------------------------------- +looped SECTION tests + b is currently: 1 +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: FAILED: + CHECK( b > a ) +with expansion: + 1 > 1 + +------------------------------------------------------------------------------- +looped SECTION tests + b is currently: 2 +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: +PASSED: + CHECK( b > a ) +with expansion: + 2 > 1 + +------------------------------------------------------------------------------- +looped SECTION tests + b is currently: 3 +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: +PASSED: + CHECK( b > a ) +with expansion: + 3 > 1 + +------------------------------------------------------------------------------- +looped SECTION tests + b is currently: 4 +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: +PASSED: + CHECK( b > a ) +with expansion: + 4 > 1 + +------------------------------------------------------------------------------- +looped SECTION tests + b is currently: 5 +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: +PASSED: + CHECK( b > a ) +with expansion: + 5 > 1 + +------------------------------------------------------------------------------- +looped SECTION tests + b is currently: 6 +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: +PASSED: + CHECK( b > a ) +with expansion: + 6 > 1 + +------------------------------------------------------------------------------- +looped SECTION tests + b is currently: 7 +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: +PASSED: + CHECK( b > a ) +with expansion: + 7 > 1 + +------------------------------------------------------------------------------- +looped SECTION tests + b is currently: 8 +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: +PASSED: + CHECK( b > a ) +with expansion: + 8 > 1 + +------------------------------------------------------------------------------- +looped SECTION tests + b is currently: 9 +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: +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:<line number> ............................................................................... @@ -7843,8 +7959,8 @@ with expansion: ------------------------------------------------------------------------------- more nested SECTION tests - s1 - s3 + doesn't equal + not equal ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... @@ -7857,8 +7973,8 @@ with expansion: ------------------------------------------------------------------------------- more nested SECTION tests - s1 - s4 + doesn't equal + less than ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... @@ -7871,7 +7987,7 @@ with expansion: ------------------------------------------------------------------------------- nested SECTION tests - s1 + doesn't equal ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... @@ -7890,8 +8006,8 @@ with expansion: ------------------------------------------------------------------------------- nested SECTION tests - s1 - s2 + doesn't equal + not equal ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... @@ -7993,7 +8109,7 @@ with expansion: ------------------------------------------------------------------------------- random SECTION tests - s1 + doesn't equal ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... @@ -8012,7 +8128,7 @@ with expansion: ------------------------------------------------------------------------------- random SECTION tests - s2 + not equal ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... @@ -8973,7 +9089,9 @@ with expansion: ------------------------------------------------------------------------------- xmlentitycheck - embedded xml + embedded xml: <test>it should be possible to embed xml characters, such as <, + " or &, or even whole <xml>documents</xml> within an attribute</test> + </test> ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... @@ -8983,7 +9101,7 @@ PASSED: ------------------------------------------------------------------------------- xmlentitycheck - encoded chars + encoded chars: these should all be encoded: &&&"""<<<&"<<&" ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... @@ -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 @@ <?xml version="1.0" encoding="UTF-8"?> <testsuitesloose text artifact > - <testsuite name="<exe-name>" errors="17" failures="105" tests="1080" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}"> + <testsuite name="<exe-name>" errors="17" failures="106" tests="1089" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}"> <testcase classname="<exe-name>.global" name="# A test name that starts with a #" time="{duration}"/> <testcase classname="<exe-name>.global" name="#1005: Comparing pointer to int and long (NULL can be either on various systems)" time="{duration}"/> <testcase classname="<exe-name>.global" name="#1027" time="{duration}"/> @@ -471,7 +471,7 @@ Message.tests.cpp:<line number> <testcase classname="<exe-name>.global" name="Pointers can be compared to null" time="{duration}"/> <testcase classname="<exe-name>.global" name="Process can be configured on command line/empty args don't cause a crash" time="{duration}"/> <testcase classname="<exe-name>.global" name="Process can be configured on command line/default - no arguments" time="{duration}"/> - <testcase classname="<exe-name>.global" name="Process can be configured on command line/test lists/1 test" time="{duration}"/> + <testcase classname="<exe-name>.global" name="Process can be configured on command line/test lists/Specify one test case using" time="{duration}"/> <testcase classname="<exe-name>.global" name="Process can be configured on command line/test lists/Specify one test case exclusion using exclude:" time="{duration}"/> <testcase classname="<exe-name>.global" name="Process can be configured on command line/test lists/Specify one test case exclusion using ~" time="{duration}"/> <testcase classname="<exe-name>.global" name="Process can be configured on command line/reporter/-r/console" time="{duration}"/> @@ -750,11 +750,24 @@ Message.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="long long" time="{duration}"/> - <testcase classname="<exe-name>.global" name="looped SECTION tests/s1" time="{duration}"> + <testcase classname="<exe-name>.global" name="looped SECTION tests/b is currently: 0" time="{duration}"> <failure message="0 > 1" type="CHECK"> Misc.tests.cpp:<line number> </failure> </testcase> + <testcase classname="<exe-name>.global" name="looped SECTION tests/b is currently: 1" time="{duration}"> + <failure message="1 > 1" type="CHECK"> +Misc.tests.cpp:<line number> + </failure> + </testcase> + <testcase classname="<exe-name>.global" name="looped SECTION tests/b is currently: 2" time="{duration}"/> + <testcase classname="<exe-name>.global" name="looped SECTION tests/b is currently: 3" time="{duration}"/> + <testcase classname="<exe-name>.global" name="looped SECTION tests/b is currently: 4" time="{duration}"/> + <testcase classname="<exe-name>.global" name="looped SECTION tests/b is currently: 5" time="{duration}"/> + <testcase classname="<exe-name>.global" name="looped SECTION tests/b is currently: 6" time="{duration}"/> + <testcase classname="<exe-name>.global" name="looped SECTION tests/b is currently: 7" time="{duration}"/> + <testcase classname="<exe-name>.global" name="looped SECTION tests/b is currently: 8" time="{duration}"/> + <testcase classname="<exe-name>.global" name="looped SECTION tests/b is currently: 9" time="{duration}"/> <testcase classname="<exe-name>.global" name="looped tests" time="{duration}"> <failure message="1 == 0" type="CHECK"> Testing if fib[0] (1) is even @@ -781,15 +794,15 @@ Testing if fib[7] (21) is even Misc.tests.cpp:<line number> </failure> </testcase> - <testcase classname="<exe-name>.global" name="more nested SECTION tests/s2/s1" time="{duration}"> + <testcase classname="<exe-name>.global" name="more nested SECTION tests/equal/doesn't equal" time="{duration}"> <failure message="1 == 2" type="REQUIRE"> Misc.tests.cpp:<line number> </failure> </testcase> - <testcase classname="<exe-name>.global" name="more nested SECTION tests/s1/s3" time="{duration}"/> - <testcase classname="<exe-name>.global" name="more nested SECTION tests/s1/s4" time="{duration}"/> - <testcase classname="<exe-name>.global" name="nested SECTION tests/s1" time="{duration}"/> - <testcase classname="<exe-name>.global" name="nested SECTION tests/s1/s2" time="{duration}"/> + <testcase classname="<exe-name>.global" name="more nested SECTION tests/doesn't equal/not equal" time="{duration}"/> + <testcase classname="<exe-name>.global" name="more nested SECTION tests/doesn't equal/less than" time="{duration}"/> + <testcase classname="<exe-name>.global" name="nested SECTION tests/doesn't equal" time="{duration}"/> + <testcase classname="<exe-name>.global" name="nested SECTION tests/doesn't equal/not equal" time="{duration}"/> <testcase classname="<exe-name>.global" name="non streamable - with conv. op" time="{duration}"/> <testcase classname="<exe-name>.global" name="non-copyable objects" time="{duration}"/> <testcase classname="<exe-name>.global" name="not allowed" time="{duration}"/> @@ -797,8 +810,8 @@ Misc.tests.cpp:<line number> <testcase classname="<exe-name>.global" name="null_ptr" time="{duration}"/> <testcase classname="<exe-name>.global" name="pair<pair<int,const char *,pair<std::string,int> > -> toString" time="{duration}"/> <testcase classname="<exe-name>.global" name="pointer to class" time="{duration}"/> - <testcase classname="<exe-name>.global" name="random SECTION tests/s1" time="{duration}"/> - <testcase classname="<exe-name>.global" name="random SECTION tests/s2" time="{duration}"/> + <testcase classname="<exe-name>.global" name="random SECTION tests/doesn't equal" time="{duration}"/> + <testcase classname="<exe-name>.global" name="random SECTION tests/not equal" time="{duration}"/> <testcase classname="<exe-name>.global" name="replaceInPlace/replace single char" time="{duration}"/> <testcase classname="<exe-name>.global" name="replaceInPlace/replace two chars" time="{duration}"/> <testcase classname="<exe-name>.global" name="replaceInPlace/replace first char" time="{duration}"/> @@ -873,8 +886,8 @@ Exception.tests.cpp:<line number> <testcase classname="<exe-name>.global" name="vectors can be sized and resized/resizing smaller changes size but not capacity/We can use the 'swap trick' to reset the capacity" time="{duration}"/> <testcase classname="<exe-name>.global" name="vectors can be sized and resized/reserving bigger changes capacity but not size" time="{duration}"/> <testcase classname="<exe-name>.global" name="vectors can be sized and resized/reserving smaller does not change size or capacity" time="{duration}"/> - <testcase classname="<exe-name>.global" name="xmlentitycheck/embedded xml" time="{duration}"/> - <testcase classname="<exe-name>.global" name="xmlentitycheck/encoded chars" time="{duration}"/> + <testcase classname="<exe-name>.global" name="xmlentitycheck/embedded xml: <test>it should be possible to embed xml characters, such as <, " or &, or even whole <xml>documents</xml> within an attribute</test>" time="{duration}"/> + <testcase classname="<exe-name>.global" name="xmlentitycheck/encoded chars: these should all be encoded: &&&"""<<<&"<<&"" time="{duration}"/> <system-out> 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 @@ <OverallResults successes="7" failures="0" expectedFailures="0"/> </Section> <Section name="test lists" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Section name="1 test" description="Specify one test case using" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="Specify one test case using" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Original> result @@ -8691,7 +8691,7 @@ loose text artifact <OverallResult success="true"/> </TestCase> <TestCase name="looped SECTION tests" tags="[.][failing][sections]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > - <Section name="s1" description="b is currently: 0" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > + <Section name="b is currently: 0" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> b > a @@ -8702,6 +8702,105 @@ loose text artifact </Expression> <OverallResults successes="0" failures="1" expectedFailures="0"/> </Section> + <Section name="b is currently: 1" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + b > a + </Original> + <Expanded> + 1 > 1 + </Expanded> + </Expression> + <OverallResults successes="0" failures="1" expectedFailures="0"/> + </Section> + <Section name="b is currently: 2" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + b > a + </Original> + <Expanded> + 2 > 1 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="b is currently: 3" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + b > a + </Original> + <Expanded> + 3 > 1 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="b is currently: 4" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + b > a + </Original> + <Expanded> + 4 > 1 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="b is currently: 5" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + b > a + </Original> + <Expanded> + 5 > 1 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="b is currently: 6" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + b > a + </Original> + <Expanded> + 6 > 1 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="b is currently: 7" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + b > a + </Original> + <Expanded> + 7 > 1 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="b is currently: 8" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + b > a + </Original> + <Expanded> + 8 > 1 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="b is currently: 9" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + b > a + </Original> + <Expanded> + 9 > 1 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> <OverallResult success="false"/> </TestCase> <TestCase name="looped tests" tags="[.][failing]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -8796,8 +8895,8 @@ loose text artifact <OverallResult success="false"/> </TestCase> <TestCase name="more nested SECTION tests" tags="[.][failing][sections]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > - <Section name="s1" description="doesn't equal" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > - <Section name="s2" description="equal" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > + <Section name="doesn't equal" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > + <Section name="equal" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="false" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> a == b @@ -8810,8 +8909,8 @@ loose text artifact </Section> <OverallResults successes="0" failures="1" expectedFailures="0"/> </Section> - <Section name="s1" description="doesn't equal" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > - <Section name="s3" description="not equal" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > + <Section name="doesn't equal" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > + <Section name="not equal" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> a != b @@ -8824,8 +8923,8 @@ loose text artifact </Section> <OverallResults successes="1" failures="0" expectedFailures="0"/> </Section> - <Section name="s1" description="doesn't equal" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > - <Section name="s4" description="less than" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > + <Section name="doesn't equal" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > + <Section name="less than" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> a < b @@ -8841,7 +8940,7 @@ loose text artifact <OverallResult success="false"/> </TestCase> <TestCase name="nested SECTION tests" tags="[.][failing][sections]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > - <Section name="s1" description="doesn't equal" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > + <Section name="doesn't equal" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> a != b @@ -8858,7 +8957,7 @@ loose text artifact 2 != 1 </Expanded> </Expression> - <Section name="s2" description="not equal" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > + <Section name="not equal" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> a != b @@ -8953,7 +9052,7 @@ loose text artifact <OverallResult success="true"/> </TestCase> <TestCase name="random SECTION tests" tags="[.][failing][sections]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > - <Section name="s1" description="doesn't equal" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > + <Section name="doesn't equal" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> a != b @@ -8972,7 +9071,7 @@ loose text artifact </Expression> <OverallResults successes="2" failures="0" expectedFailures="0"/> </Section> - <Section name="s2" description="not equal" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > + <Section name="not equal" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> a != b @@ -9928,15 +10027,15 @@ loose text artifact <OverallResult success="true"/> </TestCase> <TestCase name="xmlentitycheck" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > - <Section name="embedded xml" description="<test>it should be possible to embed xml characters, such as <, " or &, or even whole <xml>documents</xml> within an attribute</test>" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > + <Section name="embedded xml: <test>it should be possible to embed xml characters, such as <, " or &, or even whole <xml>documents</xml> within an attribute</test>" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <OverallResults successes="1" failures="0" expectedFailures="0"/> </Section> - <Section name="encoded chars" description="these should all be encoded: &&&"""<<<&"<<&"" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > + <Section name="encoded chars: these should all be encoded: &&&"""<<<&"<<&"" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <OverallResults successes="1" failures="0" expectedFailures="0"/> </Section> <OverallResult success="true"/> </TestCase> - <OverallResults successes="937" failures="122" expectedFailures="21"/> + <OverallResults successes="945" failures="123" expectedFailures="21"/> </Group> - <OverallResults successes="937" failures="121" expectedFailures="21"/> + <OverallResults successes="945" failures="122" expectedFailures="21"/> </Catch> 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", "<test>it should be possible to embed xml characters, such as <, \" or &, or even whole <xml>documents</xml> within an attribute</test>" ) { - SUCCEED(""); // We need this here to stop it failing due to no tests + SECTION( "embedded xml: <test>it should be possible to embed xml characters, such as <, \" or &, or even whole <xml>documents</xml> within an attribute</test>" ) { + 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<true>::value == true ); REQUIRE( true == is_true<true>::value ); } - SECTION("compare to false","") + SECTION("compare to false") { REQUIRE( is_true<false>::value == false ); REQUIRE( false == is_true<false>::value ); } - SECTION("negation", "") + SECTION("negation") { REQUIRE( !is_true<false>::value ); } - SECTION("double negation","") + SECTION("double negation") { REQUIRE( !!is_true<true>::value ); } - SECTION("direct","") + SECTION("direct") { REQUIRE( is_true<true>::value ); REQUIRE_FALSE( is_true<false>::value );