mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-26 07:16:10 +01:00
Fixed up xml reporter and rebased
This commit is contained in:
parent
3e0c501812
commit
6817bb099d
@ -35,6 +35,9 @@ namespace Catch {
|
|||||||
bool allPassed() const {
|
bool allPassed() const {
|
||||||
return failed == 0 && failedButOk == 0;
|
return failed == 0 && failedButOk == 0;
|
||||||
}
|
}
|
||||||
|
bool allOk() const {
|
||||||
|
return failed == 0;
|
||||||
|
}
|
||||||
|
|
||||||
std::size_t passed;
|
std::size_t passed;
|
||||||
std::size_t failed;
|
std::size_t failed;
|
||||||
|
@ -99,7 +99,7 @@ namespace Catch {
|
|||||||
if( assertionResult.hasExpression() ) {
|
if( assertionResult.hasExpression() ) {
|
||||||
m_xml.startElement( "Expression" )
|
m_xml.startElement( "Expression" )
|
||||||
.writeAttribute( "success", assertionResult.succeeded() )
|
.writeAttribute( "success", assertionResult.succeeded() )
|
||||||
.writeAttribute( "type", assertionResult.getTestMacroName() )
|
// .writeAttribute( "type", assertionResult.getTestMacroName() )
|
||||||
.writeAttribute( "filename", assertionResult.getSourceInfo().file )
|
.writeAttribute( "filename", assertionResult.getSourceInfo().file )
|
||||||
.writeAttribute( "line", assertionResult.getSourceInfo().line );
|
.writeAttribute( "line", assertionResult.getSourceInfo().line );
|
||||||
|
|
||||||
@ -111,8 +111,6 @@ namespace Catch {
|
|||||||
|
|
||||||
// And... Print a result applicable to each result type.
|
// And... Print a result applicable to each result type.
|
||||||
switch( assertionResult.getResultType() ) {
|
switch( assertionResult.getResultType() ) {
|
||||||
default:
|
|
||||||
break;
|
|
||||||
case ResultWas::ThrewException:
|
case ResultWas::ThrewException:
|
||||||
m_xml.scopedElement( "Exception" )
|
m_xml.scopedElement( "Exception" )
|
||||||
.writeAttribute( "filename", assertionResult.getSourceInfo().file )
|
.writeAttribute( "filename", assertionResult.getSourceInfo().file )
|
||||||
@ -130,13 +128,14 @@ namespace Catch {
|
|||||||
.writeText( assertionResult.getMessage() );
|
.writeText( assertionResult.getMessage() );
|
||||||
break;
|
break;
|
||||||
case ResultWas::Warning:
|
case ResultWas::Warning:
|
||||||
m_xml.scopedElement( "Warning" )
|
// Warning will already have been written
|
||||||
.writeText( assertionResult.getMessage() );
|
|
||||||
break;
|
break;
|
||||||
case ResultWas::ExplicitFailure:
|
case ResultWas::ExplicitFailure:
|
||||||
m_xml.scopedElement( "Failure" )
|
m_xml.scopedElement( "Failure" )
|
||||||
.writeText( assertionResult.getMessage() );
|
.writeText( assertionResult.getMessage() );
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( assertionResult.hasExpression() )
|
if( assertionResult.hasExpression() )
|
||||||
@ -163,7 +162,7 @@ namespace Catch {
|
|||||||
virtual void testCaseEnded( TestCaseStats const& testCaseStats ) {
|
virtual void testCaseEnded( TestCaseStats const& testCaseStats ) {
|
||||||
StreamingReporterBase::testCaseEnded( testCaseStats );
|
StreamingReporterBase::testCaseEnded( testCaseStats );
|
||||||
XmlWriter::ScopedElement e = m_xml.scopedElement( "OverallResult" );
|
XmlWriter::ScopedElement e = m_xml.scopedElement( "OverallResult" );
|
||||||
e.writeAttribute( "success", testCaseStats.totals.assertions.allPassed() );
|
e.writeAttribute( "success", testCaseStats.totals.assertions.allOk() );
|
||||||
|
|
||||||
if ( m_config->showDurations() == ShowDurations::Always )
|
if ( m_config->showDurations() == ShowDurations::Always )
|
||||||
e.writeAttribute( "durationInSeconds", m_testCaseTimer.getElapsedSeconds() );
|
e.writeAttribute( "durationInSeconds", m_testCaseTimer.getElapsedSeconds() );
|
||||||
|
@ -787,5 +787,5 @@ with expansion:
|
|||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
test cases: 149 | 110 passed | 38 failed | 1 failed as expected
|
test cases: 149 | 110 passed | 38 failed | 1 failed as expected
|
||||||
assertions: 751 | 659 passed | 79 failed | 13 failed as expected
|
assertions: 753 | 661 passed | 79 failed | 13 failed as expected
|
||||||
|
|
||||||
|
@ -4632,6 +4632,25 @@ PASSED:
|
|||||||
with expansion:
|
with expansion:
|
||||||
"abcdefcg" == "abcdefcg"
|
"abcdefcg" == "abcdefcg"
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
replaceInPlace
|
||||||
|
escape '
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
TestMain.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
TestMain.cpp:<line number>:
|
||||||
|
PASSED:
|
||||||
|
CHECK( replaceInPlace( s, "'", "|'" ) )
|
||||||
|
with expansion:
|
||||||
|
true
|
||||||
|
|
||||||
|
TestMain.cpp:<line number>:
|
||||||
|
PASSED:
|
||||||
|
CHECK( s == "didn|'t" )
|
||||||
|
with expansion:
|
||||||
|
"didn|'t" == "didn|'t"
|
||||||
|
|
||||||
hello
|
hello
|
||||||
hello
|
hello
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
@ -7798,5 +7817,5 @@ with expansion:
|
|||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
test cases: 149 | 94 passed | 54 failed | 1 failed as expected
|
test cases: 149 | 94 passed | 54 failed | 1 failed as expected
|
||||||
assertions: 771 | 659 passed | 99 failed | 13 failed as expected
|
assertions: 773 | 661 passed | 99 failed | 13 failed as expected
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<testsuites>
|
<testsuites>
|
||||||
<testsuite name="all tests" errors="12" failures="87" tests="771" hostname="tbd" time="{duration}" timestamp="tbd">
|
<testsuite name="all tests" errors="12" failures="87" tests="773" hostname="tbd" time="{duration}" timestamp="tbd">
|
||||||
<testcase classname="global" name="toString(enum)" time="{duration}"/>
|
<testcase classname="global" name="toString(enum)" time="{duration}"/>
|
||||||
<testcase classname="global" name="toString(enum w/operator<<)" time="{duration}"/>
|
<testcase classname="global" name="toString(enum w/operator<<)" time="{duration}"/>
|
||||||
<testcase classname="global" name="toString(enum class)" time="{duration}"/>
|
<testcase classname="global" name="toString(enum class)" time="{duration}"/>
|
||||||
@ -491,6 +491,7 @@ MiscTests.cpp:<line number>
|
|||||||
<testcase classname="replaceInPlace" name="replace last char" time="{duration}"/>
|
<testcase classname="replaceInPlace" name="replace last char" time="{duration}"/>
|
||||||
<testcase classname="replaceInPlace" name="replace all chars" time="{duration}"/>
|
<testcase classname="replaceInPlace" name="replace all chars" time="{duration}"/>
|
||||||
<testcase classname="replaceInPlace" name="replace no chars" time="{duration}"/>
|
<testcase classname="replaceInPlace" name="replace no chars" time="{duration}"/>
|
||||||
|
<testcase classname="replaceInPlace" name="escape '" time="{duration}"/>
|
||||||
<testcase classname="global" name="Strings can be rendered with colour" time="{duration}">
|
<testcase classname="global" name="Strings can be rendered with colour" time="{duration}">
|
||||||
<system-out>
|
<system-out>
|
||||||
hello
|
hello
|
||||||
|
@ -531,7 +531,7 @@
|
|||||||
1.3 == Approx( 1.301 )
|
1.3 == Approx( 1.301 )
|
||||||
</Expanded>
|
</Expanded>
|
||||||
</Expression>
|
</Expression>
|
||||||
<OverallResult success="false"/>
|
<OverallResult success="true"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<TestCase name="Inequality checks that should succeed">
|
<TestCase name="Inequality checks that should succeed">
|
||||||
<Expression success="true" filename="projects/SelfTest/ConditionTests.cpp" >
|
<Expression success="true" filename="projects/SelfTest/ConditionTests.cpp" >
|
||||||
@ -1541,7 +1541,7 @@
|
|||||||
<OverallResult success="false"/>
|
<OverallResult success="false"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<TestCase name="When unchecked exceptions are thrown, but caught, they do not affect the test">
|
<TestCase name="When unchecked exceptions are thrown, but caught, they do not affect the test">
|
||||||
<OverallResult success="true"/>
|
<OverallResult success="false"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<TestCase name="Unexpected custom exceptions can be translated">
|
<TestCase name="Unexpected custom exceptions can be translated">
|
||||||
<Exception filename="projects/SelfTest/ExceptionTests.cpp" >
|
<Exception filename="projects/SelfTest/ExceptionTests.cpp" >
|
||||||
@ -2775,7 +2775,7 @@
|
|||||||
<Warning>
|
<Warning>
|
||||||
this is a warning
|
this is a warning
|
||||||
</Warning>
|
</Warning>
|
||||||
<OverallResult success="true"/>
|
<OverallResult success="false"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<TestCase name="SUCCEED counts as a test pass">
|
<TestCase name="SUCCEED counts as a test pass">
|
||||||
<OverallResult success="true"/>
|
<OverallResult success="true"/>
|
||||||
@ -2873,7 +2873,7 @@
|
|||||||
<Section name="two">
|
<Section name="two">
|
||||||
<OverallResults successes="0" failures="1" expectedFailures="0"/>
|
<OverallResults successes="0" failures="1" expectedFailures="0"/>
|
||||||
</Section>
|
</Section>
|
||||||
<OverallResult success="true"/>
|
<OverallResult success="false"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<TestCase name="SCOPED_INFO is reset for each loop">
|
<TestCase name="SCOPED_INFO is reset for each loop">
|
||||||
<Expression success="true" filename="projects/SelfTest/MessageTests.cpp" >
|
<Expression success="true" filename="projects/SelfTest/MessageTests.cpp" >
|
||||||
@ -2984,7 +2984,7 @@
|
|||||||
<OverallResult success="false"/>
|
<OverallResult success="false"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<TestCase name="just info">
|
<TestCase name="just info">
|
||||||
<OverallResult success="true"/>
|
<OverallResult success="false"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<TestCase name="just failure">
|
<TestCase name="just failure">
|
||||||
<Failure>
|
<Failure>
|
||||||
@ -3016,7 +3016,7 @@
|
|||||||
<Warning>
|
<Warning>
|
||||||
toString(p): 0x<hex digits>
|
toString(p): 0x<hex digits>
|
||||||
</Warning>
|
</Warning>
|
||||||
<OverallResult success="true"/>
|
<OverallResult success="false"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<TestCase name="random SECTION tests">
|
<TestCase name="random SECTION tests">
|
||||||
<Section name="s1" description="doesn't equal">
|
<Section name="s1" description="doesn't equal">
|
||||||
@ -3117,7 +3117,7 @@
|
|||||||
<Section name="f (leaf)">
|
<Section name="f (leaf)">
|
||||||
<OverallResults successes="0" failures="1" expectedFailures="0"/>
|
<OverallResults successes="0" failures="1" expectedFailures="0"/>
|
||||||
</Section>
|
</Section>
|
||||||
<OverallResult success="true"/>
|
<OverallResult success="false"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<TestCase name="looped SECTION tests">
|
<TestCase name="looped SECTION tests">
|
||||||
<Section name="s1" description="b is currently: 0">
|
<Section name="s1" description="b is currently: 0">
|
||||||
@ -3219,7 +3219,7 @@
|
|||||||
<OverallResult success="false"/>
|
<OverallResult success="false"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<TestCase name="Sends stuff to stdout and stderr">
|
<TestCase name="Sends stuff to stdout and stderr">
|
||||||
<OverallResult success="true"/>
|
<OverallResult success="false"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<TestCase name="null strings">
|
<TestCase name="null strings">
|
||||||
<Expression success="true" filename="projects/SelfTest/MiscTests.cpp" >
|
<Expression success="true" filename="projects/SelfTest/MiscTests.cpp" >
|
||||||
@ -3323,7 +3323,7 @@
|
|||||||
<Section name="encoded chars" description="these should all be encoded: &&&"""<<<&"<<&"">
|
<Section name="encoded chars" description="these should all be encoded: &&&"""<<<&"<<&"">
|
||||||
<OverallResults successes="0" failures="1" expectedFailures="0"/>
|
<OverallResults successes="0" failures="1" expectedFailures="0"/>
|
||||||
</Section>
|
</Section>
|
||||||
<OverallResult success="true"/>
|
<OverallResult success="false"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<TestCase name="send a single char to INFO">
|
<TestCase name="send a single char to INFO">
|
||||||
<Info>
|
<Info>
|
||||||
@ -3525,19 +3525,19 @@
|
|||||||
<OverallResult success="true"/>
|
<OverallResult success="true"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<TestCase name="An empty test with no assertions">
|
<TestCase name="An empty test with no assertions">
|
||||||
<OverallResult success="true"/>
|
<OverallResult success="false"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<TestCase name="Nice descriptive name">
|
<TestCase name="Nice descriptive name">
|
||||||
<Warning>
|
<Warning>
|
||||||
This one ran
|
This one ran
|
||||||
</Warning>
|
</Warning>
|
||||||
<OverallResult success="true"/>
|
<OverallResult success="false"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<TestCase name="first tag">
|
<TestCase name="first tag">
|
||||||
<OverallResult success="true"/>
|
<OverallResult success="false"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<TestCase name="second tag">
|
<TestCase name="second tag">
|
||||||
<OverallResult success="true"/>
|
<OverallResult success="false"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<TestCase name="vectors can be sized and resized">
|
<TestCase name="vectors can be sized and resized">
|
||||||
<Expression success="true" filename="projects/SelfTest/MiscTests.cpp" >
|
<Expression success="true" filename="projects/SelfTest/MiscTests.cpp" >
|
||||||
@ -4829,10 +4829,29 @@ four"
|
|||||||
</Expression>
|
</Expression>
|
||||||
<OverallResults successes="2" failures="0" expectedFailures="0"/>
|
<OverallResults successes="2" failures="0" expectedFailures="0"/>
|
||||||
</Section>
|
</Section>
|
||||||
|
<Section name="escape '">
|
||||||
|
<Expression success="true" filename="projects/SelfTest/TestMain.cpp" >
|
||||||
|
<Original>
|
||||||
|
replaceInPlace( s, "'", "|'" )
|
||||||
|
</Original>
|
||||||
|
<Expanded>
|
||||||
|
true
|
||||||
|
</Expanded>
|
||||||
|
</Expression>
|
||||||
|
<Expression success="true" filename="projects/SelfTest/TestMain.cpp" >
|
||||||
|
<Original>
|
||||||
|
s == "didn|'t"
|
||||||
|
</Original>
|
||||||
|
<Expanded>
|
||||||
|
"didn|'t" == "didn|'t"
|
||||||
|
</Expanded>
|
||||||
|
</Expression>
|
||||||
|
<OverallResults successes="2" failures="0" expectedFailures="0"/>
|
||||||
|
</Section>
|
||||||
<OverallResult success="true"/>
|
<OverallResult success="true"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<TestCase name="Strings can be rendered with colour">
|
<TestCase name="Strings can be rendered with colour">
|
||||||
<OverallResult success="true"/>
|
<OverallResult success="false"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<TestCase name="Text can be formatted using the Text class">
|
<TestCase name="Text can be formatted using the Text class">
|
||||||
<Expression success="true" filename="projects/SelfTest/TestMain.cpp" >
|
<Expression success="true" filename="projects/SelfTest/TestMain.cpp" >
|
||||||
@ -5883,13 +5902,13 @@ there"
|
|||||||
<Warning>
|
<Warning>
|
||||||
Uncomment the code in this test to check that it gives a sensible compiler error
|
Uncomment the code in this test to check that it gives a sensible compiler error
|
||||||
</Warning>
|
</Warning>
|
||||||
<OverallResult success="true"/>
|
<OverallResult success="false"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<TestCase name="Where the LHS is not a simple value">
|
<TestCase name="Where the LHS is not a simple value">
|
||||||
<Warning>
|
<Warning>
|
||||||
Uncomment the code in this test to check that it gives a sensible compiler error
|
Uncomment the code in this test to check that it gives a sensible compiler error
|
||||||
</Warning>
|
</Warning>
|
||||||
<OverallResult success="true"/>
|
<OverallResult success="false"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<TestCase name="A failing expression with a non streamable type is still captured">
|
<TestCase name="A failing expression with a non streamable type is still captured">
|
||||||
<Expression success="false" filename="projects/SelfTest/TrickyTests.cpp" >
|
<Expression success="false" filename="projects/SelfTest/TrickyTests.cpp" >
|
||||||
@ -8067,7 +8086,7 @@ there"
|
|||||||
</Section>
|
</Section>
|
||||||
<OverallResult success="true"/>
|
<OverallResult success="true"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<OverallResults successes="659" failures="99" expectedFailures="13"/>
|
<OverallResults successes="661" failures="99" expectedFailures="13"/>
|
||||||
</Group>
|
</Group>
|
||||||
<OverallResults successes="659" failures="99" expectedFailures="13"/>
|
<OverallResults successes="661" failures="99" expectedFailures="13"/>
|
||||||
</Catch>
|
</Catch>
|
||||||
|
@ -374,6 +374,11 @@ TEST_CASE( "replaceInPlace", "" ) {
|
|||||||
CHECK_FALSE( replaceInPlace( letters, "x", "z" ) );
|
CHECK_FALSE( replaceInPlace( letters, "x", "z" ) );
|
||||||
CHECK( letters == letters );
|
CHECK( letters == letters );
|
||||||
}
|
}
|
||||||
|
SECTION( "escape '" ) {
|
||||||
|
std::string s = "didn't";
|
||||||
|
CHECK( replaceInPlace( s, "'", "|'" ) );
|
||||||
|
CHECK( s == "didn|'t" );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// !TBD: This will be folded into Text class
|
// !TBD: This will be folded into Text class
|
||||||
|
Loading…
Reference in New Issue
Block a user