diff options
| author | Alexander Stein | 2019-08-07 22:39:01 +0200 |
|---|---|---|
| committer | Martin Hořeňovský | 2019-10-27 18:02:14 +0100 |
| commit | 2fbd66c51cbf3a406dc6bb8ddc6b9a0b96077a72 (patch) | |
| tree | e62dd130cbeca1bb6f77920b18efb4328eecb0c9 | |
| parent | 51b29ced1ac2bde83d977283f6e0b4f871898b8a (diff) | |
| download | catch3-2fbd66c51cbf3a406dc6bb8ddc6b9a0b96077a72.tar.gz | |
Improve JUnit failure report
The JUnit report is improved in that:
* The message shows the testing condition, not the result
* The actual message has similar output than the console one
| -rw-r--r-- | include/reporters/catch_reporter_junit.cpp | 18 | ||||
| -rw-r--r-- | projects/SelfTest/Baselines/junit.sw.approved.txt | 754 |
2 files changed, 653 insertions, 119 deletions
diff --git a/include/reporters/catch_reporter_junit.cpp b/include/reporters/catch_reporter_junit.cpp index e8375862..f47f58f7 100644 --- a/include/reporters/catch_reporter_junit.cpp +++ b/include/reporters/catch_reporter_junit.cpp @@ -12,6 +12,7 @@ #include "../internal/catch_tostring.h" #include "../internal/catch_reporter_registrars.hpp" +#include "../internal/catch_text.h" #include <cassert> #include <sstream> @@ -244,10 +245,25 @@ namespace Catch { XmlWriter::ScopedElement e = xml.scopedElement( elementName ); - xml.writeAttribute( "message", result.getExpandedExpression() ); + xml.writeAttribute( "message", result.getExpression() ); xml.writeAttribute( "type", result.getTestMacroName() ); ReusableStringStream rss; + if (stats.totals.assertions.total() > 0) { + rss << "FAILED" << ":\n"; + if (result.hasExpression()) { + rss << " "; + rss << result.getExpressionInMacro(); + rss << '\n'; + } + if (result.hasExpandedExpression()) { + rss << "with expansion:\n"; + rss << Column(result.getExpandedExpression()).indent(2) << '\n'; + } + } else { + rss << '\n'; + } + if( !result.getMessage().empty() ) rss << result.getMessage() << '\n'; for( auto const& msg : stats.infoMessages ) diff --git a/projects/SelfTest/Baselines/junit.sw.approved.txt b/projects/SelfTest/Baselines/junit.sw.approved.txt index 82bf925f..588c3a21 100644 --- a/projects/SelfTest/Baselines/junit.sw.approved.txt +++ b/projects/SelfTest/Baselines/junit.sw.approved.txt @@ -18,6 +18,7 @@ <testcase classname="<exe-name>.global" name="#1455 - INFO and WARN can start with a linebreak" time="{duration}"/> <testcase classname="<exe-name>.global" name="#1514: stderr/stdout is not captured in tests aborted by an exception" time="{duration}"> <failure type="FAIL"> +FAILED: 1514 Tricky.tests.cpp:<line number> </failure> @@ -31,6 +32,7 @@ Nor would this <testcase classname="<exe-name>.global" name="#1548" time="{duration}"/> <testcase classname="<exe-name>.global" name="#748 - captures with unexpected exceptions/outside assertions" time="{duration}"> <error type="TEST_CASE"> +FAILED: expected exception answer := 42 Exception.tests.cpp:<line number> @@ -38,6 +40,8 @@ Exception.tests.cpp:<line number> </testcase> <testcase classname="<exe-name>.global" name="#748 - captures with unexpected exceptions/inside REQUIRE_NOTHROW" time="{duration}"> <error message="thisThrows()" type="REQUIRE_NOTHROW"> +FAILED: + REQUIRE_NOTHROW( thisThrows() ) expected exception answer := 42 Exception.tests.cpp:<line number> @@ -47,7 +51,11 @@ Exception.tests.cpp:<line number> <testcase classname="<exe-name>.global" name="#809" time="{duration}"/> <testcase classname="<exe-name>.global" name="#833" time="{duration}"/> <testcase classname="<exe-name>.global" name="#835 -- errno should not be touched by Catch" time="{duration}"> - <failure message="1 == 0" type="CHECK"> + <failure message="f() == 0" type="CHECK"> +FAILED: + CHECK( f() == 0 ) +with expansion: + 1 == 0 Misc.tests.cpp:<line number> </failure> </testcase> @@ -59,27 +67,53 @@ Misc.tests.cpp:<line number> <testcase classname="<exe-name>.global" name="#961 -- Dynamically created sections should all be reported/Looped section 4" time="{duration}"/> <testcase classname="<exe-name>.global" name="'Not' checks that should fail" time="{duration}"> <failure message="false != false" type="CHECK"> +FAILED: + CHECK( false != false ) Condition.tests.cpp:<line number> </failure> <failure message="true != true" type="CHECK"> +FAILED: + CHECK( true != true ) Condition.tests.cpp:<line number> </failure> - <failure message="false" type="CHECK"> + <failure message="!true" type="CHECK"> +FAILED: + CHECK( !true ) +with expansion: + false Condition.tests.cpp:<line number> </failure> - <failure message="!true" type="CHECK_FALSE"> + <failure message="!(true)" type="CHECK_FALSE"> +FAILED: + CHECK_FALSE( true ) +with expansion: + !true Condition.tests.cpp:<line number> </failure> - <failure message="false" type="CHECK"> + <failure message="!trueValue" type="CHECK"> +FAILED: + CHECK( !trueValue ) +with expansion: + false Condition.tests.cpp:<line number> </failure> - <failure message="!true" type="CHECK_FALSE"> + <failure message="!(trueValue)" type="CHECK_FALSE"> +FAILED: + CHECK_FALSE( trueValue ) +with expansion: + !true Condition.tests.cpp:<line number> </failure> - <failure message="false" type="CHECK"> + <failure message="!(1 == 1)" type="CHECK"> +FAILED: + CHECK( !(1 == 1) ) +with expansion: + false Condition.tests.cpp:<line number> </failure> <failure message="!(1 == 1)" type="CHECK_FALSE"> +FAILED: + CHECK_FALSE( 1 == 1 ) Condition.tests.cpp:<line number> </failure> </testcase> @@ -91,28 +125,48 @@ Condition.tests.cpp:<line number> <testcase classname="<exe-name>.global" name="(unimplemented) static bools can be evaluated/direct" time="{duration}"/> <testcase classname="<exe-name>.global" name="3x3x3 ints" time="{duration}"/> <testcase classname="<exe-name>.TestClass" name="A METHOD_AS_TEST_CASE based test run that fails" time="{duration}"> - <failure message=""hello" == "world"" type="REQUIRE"> + <failure message="s == "world"" type="REQUIRE"> +FAILED: + REQUIRE( s == "world" ) +with expansion: + "hello" == "world" Class.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.TestClass" name="A METHOD_AS_TEST_CASE based test run that succeeds" time="{duration}"/> <testcase classname="<exe-name>.Template_Fixture_2" name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - Template_Foo<float>" time="{duration}"> - <failure message="0 == 1" type="REQUIRE"> + <failure message="Template_Fixture_2<TestType>::m_a.size() == 1" type="REQUIRE"> +FAILED: + REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 ) +with expansion: + 0 == 1 Class.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.Template_Fixture_2" name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - Template_Foo<int>" time="{duration}"> - <failure message="0 == 1" type="REQUIRE"> + <failure message="Template_Fixture_2<TestType>::m_a.size() == 1" type="REQUIRE"> +FAILED: + REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 ) +with expansion: + 0 == 1 Class.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.Template_Fixture_2" name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - std::vector<float>" time="{duration}"> - <failure message="0 == 1" type="REQUIRE"> + <failure message="Template_Fixture_2<TestType>::m_a.size() == 1" type="REQUIRE"> +FAILED: + REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 ) +with expansion: + 0 == 1 Class.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.Template_Fixture_2" name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - std::vector<int>" time="{duration}"> - <failure message="0 == 1" type="REQUIRE"> + <failure message="Template_Fixture_2<TestType>::m_a.size() == 1" type="REQUIRE"> +FAILED: + REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 ) +with expansion: + 0 == 1 Class.tests.cpp:<line number> </failure> </testcase> @@ -121,22 +175,38 @@ Class.tests.cpp:<line number> <testcase classname="<exe-name>.Template_Fixture_2" name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - std::vector<float>" time="{duration}"/> <testcase classname="<exe-name>.Template_Fixture_2" name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - std::vector<int>" time="{duration}"/> <testcase classname="<exe-name>.Template_Fixture_2" name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - Template_Foo_2<float, 6>" time="{duration}"> - <failure message="6 < 2" type="REQUIRE"> + <failure message="Template_Fixture_2<TestType>{}.m_a.size() < 2" type="REQUIRE"> +FAILED: + REQUIRE( Template_Fixture_2<TestType>{}.m_a.size() < 2 ) +with expansion: + 6 < 2 Class.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.Template_Fixture_2" name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - Template_Foo_2<int, 2>" time="{duration}"> - <failure message="2 < 2" type="REQUIRE"> + <failure message="Template_Fixture_2<TestType>{}.m_a.size() < 2" type="REQUIRE"> +FAILED: + REQUIRE( Template_Fixture_2<TestType>{}.m_a.size() < 2 ) +with expansion: + 2 < 2 Class.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.Template_Fixture_2" name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - std::array<float, 6>" time="{duration}"> - <failure message="6 < 2" type="REQUIRE"> + <failure message="Template_Fixture_2<TestType>{}.m_a.size() < 2" type="REQUIRE"> +FAILED: + REQUIRE( Template_Fixture_2<TestType>{}.m_a.size() < 2 ) +with expansion: + 6 < 2 Class.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.Template_Fixture_2" name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - std::array<int, 2>" time="{duration}"> - <failure message="2 < 2" type="REQUIRE"> + <failure message="Template_Fixture_2<TestType>{}.m_a.size() < 2" type="REQUIRE"> +FAILED: + REQUIRE( Template_Fixture_2<TestType>{}.m_a.size() < 2 ) +with expansion: + 2 < 2 Class.tests.cpp:<line number> </failure> </testcase> @@ -145,17 +215,29 @@ Class.tests.cpp:<line number> <testcase classname="<exe-name>.Template_Fixture_2" name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that succeeds - std::array<float,6>" time="{duration}"/> <testcase classname="<exe-name>.Template_Fixture_2" name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that succeeds - std::array<int,2>" time="{duration}"/> <testcase classname="<exe-name>.Template_Fixture" name="A TEMPLATE_TEST_CASE_METHOD based test run that fails - double" time="{duration}"> - <failure message="1.0 == 2" type="REQUIRE"> + <failure message="Template_Fixture<TestType>::m_a == 2" type="REQUIRE"> +FAILED: + REQUIRE( Template_Fixture<TestType>::m_a == 2 ) +with expansion: + 1.0 == 2 Class.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.Template_Fixture" name="A TEMPLATE_TEST_CASE_METHOD based test run that fails - float" time="{duration}"> - <failure message="1.0f == 2" type="REQUIRE"> + <failure message="Template_Fixture<TestType>::m_a == 2" type="REQUIRE"> +FAILED: + REQUIRE( Template_Fixture<TestType>::m_a == 2 ) +with expansion: + 1.0f == 2 Class.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.Template_Fixture" name="A TEMPLATE_TEST_CASE_METHOD based test run that fails - int" time="{duration}"> - <failure message="1 == 2" type="REQUIRE"> + <failure message="Template_Fixture<TestType>::m_a == 2" type="REQUIRE"> +FAILED: + REQUIRE( Template_Fixture<TestType>::m_a == 2 ) +with expansion: + 1 == 2 Class.tests.cpp:<line number> </failure> </testcase> @@ -163,17 +245,29 @@ Class.tests.cpp:<line number> <testcase classname="<exe-name>.Template_Fixture" name="A TEMPLATE_TEST_CASE_METHOD based test run that succeeds - float" time="{duration}"/> <testcase classname="<exe-name>.Template_Fixture" name="A TEMPLATE_TEST_CASE_METHOD based test run that succeeds - int" time="{duration}"/> <testcase classname="<exe-name>.Nttp_Fixture" name="A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 1" time="{duration}"> - <failure message="1 == 0" type="REQUIRE"> + <failure message="Nttp_Fixture<V>::value == 0" type="REQUIRE"> +FAILED: + REQUIRE( Nttp_Fixture<V>::value == 0 ) +with expansion: + 1 == 0 Class.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.Nttp_Fixture" name="A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 3" time="{duration}"> - <failure message="3 == 0" type="REQUIRE"> + <failure message="Nttp_Fixture<V>::value == 0" type="REQUIRE"> +FAILED: + REQUIRE( Nttp_Fixture<V>::value == 0 ) +with expansion: + 3 == 0 Class.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.Nttp_Fixture" name="A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 6" time="{duration}"> - <failure message="6 == 0" type="REQUIRE"> + <failure message="Nttp_Fixture<V>::value == 0" type="REQUIRE"> +FAILED: + REQUIRE( Nttp_Fixture<V>::value == 0 ) +with expansion: + 6 == 0 Class.tests.cpp:<line number> </failure> </testcase> @@ -181,7 +275,11 @@ Class.tests.cpp:<line number> <testcase classname="<exe-name>.Nttp_Fixture" name="A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 3" time="{duration}"/> <testcase classname="<exe-name>.Nttp_Fixture" name="A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 6" time="{duration}"/> <testcase classname="<exe-name>.Fixture" name="A TEST_CASE_METHOD based test run that fails" time="{duration}"> - <failure message="1 == 2" type="REQUIRE"> + <failure message="m_a == 2" type="REQUIRE"> +FAILED: + REQUIRE( m_a == 2 ) +with expansion: + 1 == 2 Class.tests.cpp:<line number> </failure> </testcase> @@ -197,16 +295,25 @@ Class.tests.cpp:<line number> <testcase classname="<exe-name>.global" name="A comparison that uses literals instead of the normal constructor" time="{duration}"/> <testcase classname="<exe-name>.global" name="A couple of nested sections followed by a failure" time="{duration}"> <failure type="FAIL"> +FAILED: to infinity and beyond Misc.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="A couple of nested sections followed by a failure/Outer/Inner" time="{duration}"/> <testcase classname="<exe-name>.global" name="A failing expression with a non streamable type is still captured" time="{duration}"> - <failure message="0x<hex digits> == 0x<hex digits>" type="CHECK"> + <failure message="&o1 == &o2" type="CHECK"> +FAILED: + CHECK( &o1 == &o2 ) +with expansion: + 0x<hex digits> == 0x<hex digits> Tricky.tests.cpp:<line number> </failure> - <failure message="{?} == {?}" type="CHECK"> + <failure message="o1 == o2" type="CHECK"> +FAILED: + CHECK( o1 == o2 ) +with expansion: + {?} == {?} Tricky.tests.cpp:<line number> </failure> </testcase> @@ -214,6 +321,8 @@ Tricky.tests.cpp:<line number> <testcase classname="<exe-name>.global" name="An expression with side-effects should only be evaluated once" time="{duration}"/> <testcase classname="<exe-name>.global" name="An unchecked exception reports the line of the last assertion" time="{duration}"> <error message="{Unknown expression after the reported line}"> +FAILED: + {Unknown expression after the reported line} unexpected exception Exception.tests.cpp:<line number> </error> @@ -248,10 +357,19 @@ Exception.tests.cpp:<line number> <testcase classname="<exe-name>.global" name="Comparisons between unsigned ints and negative signed ints match c++ standard behaviour" time="{duration}"/> <testcase classname="<exe-name>.global" name="Comparisons with int literals don't warn when mixing signed/ unsigned" time="{duration}"/> <testcase classname="<exe-name>.global" name="Contains string matcher" time="{duration}"> - <failure message=""this string contains 'abc' as a substring" contains: "not there" (case insensitive)" type="CHECK_THAT"> + <failure message="testStringForMatching(), Contains("not there", Catch::CaseSensitive::No)" type="CHECK_THAT"> +FAILED: + CHECK_THAT( testStringForMatching(), Contains("not there", Catch::CaseSensitive::No) ) +with expansion: + "this string contains 'abc' as a substring" contains: "not there" (case + insensitive) Matchers.tests.cpp:<line number> </failure> - <failure message=""this string contains 'abc' as a substring" contains: "STRING"" type="CHECK_THAT"> + <failure message="testStringForMatching(), Contains("STRING")" type="CHECK_THAT"> +FAILED: + CHECK_THAT( testStringForMatching(), Contains("STRING") ) +with expansion: + "this string contains 'abc' as a substring" contains: "STRING" Matchers.tests.cpp:<line number> </failure> </testcase> @@ -260,18 +378,23 @@ Matchers.tests.cpp:<line number> <testcase classname="<exe-name>.global" name="Copy and then generate a range/Final validation" time="{duration}"/> <testcase classname="<exe-name>.global" name="Custom exceptions can be translated when testing for nothrow" time="{duration}"> <error message="throwCustom()" type="REQUIRE_NOTHROW"> +FAILED: + REQUIRE_NOTHROW( throwCustom() ) custom exception - not std Exception.tests.cpp:<line number> </error> </testcase> <testcase classname="<exe-name>.global" name="Custom exceptions can be translated when testing for throwing as something else" time="{duration}"> <error message="throwCustom(), std::exception" type="REQUIRE_THROWS_AS"> +FAILED: + REQUIRE_THROWS_AS( throwCustom(), std::exception ) custom exception - not std Exception.tests.cpp:<line number> </error> </testcase> <testcase classname="<exe-name>.global" name="Custom std-exceptions can be custom translated" time="{duration}"> <error type="TEST_CASE"> +FAILED: custom std exception Exception.tests.cpp:<line number> </error> @@ -279,10 +402,19 @@ Exception.tests.cpp:<line number> <testcase classname="<exe-name>.global" name="Default scale is invisible to comparison" time="{duration}"/> <testcase classname="<exe-name>.global" name="Directly creating an EnumInfo" time="{duration}"/> <testcase classname="<exe-name>.global" name="EndsWith string matcher" time="{duration}"> - <failure message=""this string contains 'abc' as a substring" ends with: "Substring"" type="CHECK_THAT"> + <failure message="testStringForMatching(), EndsWith("Substring")" type="CHECK_THAT"> +FAILED: + CHECK_THAT( testStringForMatching(), EndsWith("Substring") ) +with expansion: + "this string contains 'abc' as a substring" ends with: "Substring" Matchers.tests.cpp:<line number> </failure> - <failure message=""this string contains 'abc' as a substring" ends with: "this" (case insensitive)" type="CHECK_THAT"> + <failure message="testStringForMatching(), EndsWith("this", Catch::CaseSensitive::No)" type="CHECK_THAT"> +FAILED: + CHECK_THAT( testStringForMatching(), EndsWith("this", Catch::CaseSensitive::No) ) +with expansion: + "this string contains 'abc' as a substring" ends with: "this" (case + insensitive) Matchers.tests.cpp:<line number> </failure> </testcase> @@ -290,80 +422,158 @@ Matchers.tests.cpp:<line number> <testcase classname="<exe-name>.global" name="Enums in namespaces can quickly have stringification enabled using REGISTER_ENUM" time="{duration}"/> <testcase classname="<exe-name>.global" name="Epsilon only applies to Approx's value" time="{duration}"/> <testcase classname="<exe-name>.global" name="Equality checks that should fail" time="{duration}"> - <failure message="7 == 6" type="CHECK"> + <failure message="data.int_seven == 6" type="CHECK"> +FAILED: + CHECK( data.int_seven == 6 ) +with expansion: + 7 == 6 Condition.tests.cpp:<line number> </failure> - <failure message="7 == 8" type="CHECK"> + <failure message="data.int_seven == 8" type="CHECK"> +FAILED: + CHECK( data.int_seven == 8 ) +with expansion: + 7 == 8 Condition.tests.cpp:<line number> </failure> - <failure message="7 == 0" type="CHECK"> + <failure message="data.int_seven == 0" type="CHECK"> +FAILED: + CHECK( data.int_seven == 0 ) +with expansion: + 7 == 0 Condition.tests.cpp:<line number> </failure> - <failure message="9.1f == Approx( 9.1099996567 )" type="CHECK"> + <failure message="data.float_nine_point_one == Approx( 9.11f )" type="CHECK"> +FAILED: + CHECK( data.float_nine_point_one == Approx( 9.11f ) ) +with expansion: + 9.1f == Approx( 9.1099996567 ) Condition.tests.cpp:<line number> </failure> - <failure message="9.1f == Approx( 9.0 )" type="CHECK"> + <failure message="data.float_nine_point_one == Approx( 9.0f )" type="CHECK"> +FAILED: + CHECK( data.float_nine_point_one == Approx( 9.0f ) ) +with expansion: + 9.1f == Approx( 9.0 ) Condition.tests.cpp:<line number> </failure> - <failure message="9.1f == Approx( 1.0 )" type="CHECK"> + <failure message="data.float_nine_point_one == Approx( 1 )" type="CHECK"> +FAILED: + CHECK( data.float_nine_point_one == Approx( 1 ) ) +with expansion: + 9.1f == Approx( 1.0 ) Condition.tests.cpp:<line number> </failure> - <failure message="9.1f == Approx( 0.0 )" type="CHECK"> + <failure message="data.float_nine_point_one == Approx( 0 )" type="CHECK"> +FAILED: + CHECK( data.float_nine_point_one == Approx( 0 ) ) +with expansion: + 9.1f == Approx( 0.0 ) Condition.tests.cpp:<line number> </failure> - <failure message="3.1415926535 == Approx( 3.1415 )" type="CHECK"> + <failure message="data.double_pi == Approx( 3.1415 )" type="CHECK"> +FAILED: + CHECK( data.double_pi == Approx( 3.1415 ) ) +with expansion: + 3.1415926535 == Approx( 3.1415 ) Condition.tests.cpp:<line number> </failure> - <failure message=""hello" == "goodbye"" type="CHECK"> + <failure message="data.str_hello == "goodbye"" type="CHECK"> +FAILED: + CHECK( data.str_hello == "goodbye" ) +with expansion: + "hello" == "goodbye" Condition.tests.cpp:<line number> </failure> - <failure message=""hello" == "hell"" type="CHECK"> + <failure message="data.str_hello == "hell"" type="CHECK"> +FAILED: + CHECK( data.str_hello == "hell" ) +with expansion: + "hello" == "hell" Condition.tests.cpp:<line number> </failure> - <failure message=""hello" == "hello1"" type="CHECK"> + <failure message="data.str_hello == "hello1"" type="CHECK"> +FAILED: + CHECK( data.str_hello == "hello1" ) +with expansion: + "hello" == "hello1" Condition.tests.cpp:<line number> </failure> - <failure message="5 == 6" type="CHECK"> + <failure message="data.str_hello.size() == 6" type="CHECK"> +FAILED: + CHECK( data.str_hello.size() == 6 ) +with expansion: + 5 == 6 Condition.tests.cpp:<line number> </failure> - <failure message="1.3 == Approx( 1.301 )" type="CHECK"> + <failure message="x == Approx( 1.301 )" type="CHECK"> +FAILED: + CHECK( x == Approx( 1.301 ) ) +with expansion: + 1.3 == Approx( 1.301 ) Condition.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Equality checks that should succeed" time="{duration}"/> <testcase classname="<exe-name>.global" name="Equals" time="{duration}"/> <testcase classname="<exe-name>.global" name="Equals string matcher" time="{duration}"> - <failure message=""this string contains 'abc' as a substring" equals: "this string contains 'ABC' as a substring"" type="CHECK_THAT"> + <failure message="testStringForMatching(), Equals("this string contains 'ABC' as a substring")" type="CHECK_THAT"> +FAILED: + CHECK_THAT( testStringForMatching(), Equals("this string contains 'ABC' as a substring") ) +with expansion: + "this string contains 'abc' as a substring" equals: "this string contains + 'ABC' as a substring" Matchers.tests.cpp:<line number> </failure> - <failure message=""this string contains 'abc' as a substring" equals: "something else" (case insensitive)" type="CHECK_THAT"> + <failure message="testStringForMatching(), Equals("something else", Catch::CaseSensitive::No)" type="CHECK_THAT"> +FAILED: + CHECK_THAT( testStringForMatching(), Equals("something else", Catch::CaseSensitive::No) ) +with expansion: + "this string contains 'abc' as a substring" equals: "something else" (case + insensitive) Matchers.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Exception as a value (e.g. in REQUIRE_THROWS_MATCHES) can be stringified" time="{duration}"/> <testcase classname="<exe-name>.global" name="Exception matchers that fail/No exception" time="{duration}"> <failure message="doesNotThrow(), SpecialException, ExceptionMatcher{1}" type="CHECK_THROWS_MATCHES"> +FAILED: + CHECK_THROWS_MATCHES( doesNotThrow(), SpecialException, ExceptionMatcher{1} ) Matchers.tests.cpp:<line number> </failure> <failure message="doesNotThrow(), SpecialException, ExceptionMatcher{1}" type="REQUIRE_THROWS_MATCHES"> +FAILED: + REQUIRE_THROWS_MATCHES( doesNotThrow(), SpecialException, ExceptionMatcher{1} ) Matchers.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Exception matchers that fail/Type mismatch" time="{duration}"> <error message="throwsAsInt(1), SpecialException, ExceptionMatcher{1}" type="CHECK_THROWS_MATCHES"> +FAILED: + CHECK_THROWS_MATCHES( throwsAsInt(1), SpecialException, ExceptionMatcher{1} ) Unknown exception Matchers.tests.cpp:<line number> </error> <error message="throwsAsInt(1), SpecialException, ExceptionMatcher{1}" type="REQUIRE_THROWS_MATCHES"> +FAILED: + REQUIRE_THROWS_MATCHES( throwsAsInt(1), SpecialException, ExceptionMatcher{1} ) Unknown exception Matchers.tests.cpp:<line number> </error> </testcase> <testcase classname="<exe-name>.global" name="Exception matchers that fail/Contents are wrong" time="{duration}"> - <failure message="SpecialException::what special exception has value of 1" type="CHECK_THROWS_MATCHES"> + <failure message="throwsSpecialException(3), SpecialException, ExceptionMatcher{1}" type="CHECK_THROWS_MATCHES"> +FAILED: + CHECK_THROWS_MATCHES( throwsSpecialException(3), SpecialException, ExceptionMatcher{1} ) +with expansion: + SpecialException::what special exception has value of 1 Matchers.tests.cpp:<line number> </failure> - <failure message="SpecialException::what special exception has value of 1" type="REQUIRE_THROWS_MATCHES"> + <failure message="throwsSpecialException(4), SpecialException, ExceptionMatcher{1}" type="REQUIRE_THROWS_MATCHES"> +FAILED: + REQUIRE_THROWS_MATCHES( throwsSpecialException(4), SpecialException, ExceptionMatcher{1} ) +with expansion: + SpecialException::what special exception has value of 1 Matchers.tests.cpp:<line number> </failure> </testcase> @@ -374,30 +584,39 @@ Matchers.tests.cpp:<line number> <testcase classname="<exe-name>.global" name="Exceptions matchers" time="{duration}"/> <testcase classname="<exe-name>.global" name="Expected exceptions that don't throw or unexpected exceptions fail the test" time="{duration}"> <error message="thisThrows(), std::string" type="CHECK_THROWS_AS"> +FAILED: + CHECK_THROWS_AS( thisThrows(), std::string ) expected exception Exception.tests.cpp:<line number> </error> <failure message="thisDoesntThrow(), std::domain_error" type="CHECK_THROWS_AS"> +FAILED: + CHECK_THROWS_AS( thisDoesntThrow(), std::domain_error ) Exception.tests.cpp:<line number> </failure> <error message="thisThrows()" type="CHECK_NOTHROW"> +FAILED: + CHECK_NOTHROW( thisThrows() ) expected exception Exception.tests.cpp:<line number> </error> </testcase> <testcase classname="<exe-name>.global" name="FAIL aborts the test" time="{duration}"> <failure type="FAIL"> +FAILED: This is a failure Message.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="FAIL does not require an argument" time="{duration}"> <failure type="FAIL"> +FAILED: Message.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="FAIL_CHECK does not abort the test" time="{duration}"> <failure type="FAIL_CHECK"> +FAILED: This is a failure Message.tests.cpp:<line number> </failure> @@ -453,19 +672,31 @@ Message.tests.cpp:<line number> <testcase classname="<exe-name>.global" name="Greater-than inequalities with different epsilons" time="{duration}"/> <testcase classname="<exe-name>.global" name="INFO and WARN do not abort tests" time="{duration}"/> <testcase classname="<exe-name>.global" name="INFO gets logged on failure" time="{duration}"> - <failure message="2 == 1" type="REQUIRE"> + <failure message="a == 1" type="REQUIRE"> +FAILED: + REQUIRE( a == 1 ) +with expansion: + 2 == 1 this message should be logged so should this Message.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="INFO gets logged on failure, even if captured before successful assertions" time="{duration}"> - <failure message="2 == 1" type="CHECK"> + <failure message="a == 1" type="CHECK"> +FAILED: + CHECK( a == 1 ) +with expansion: + 2 == 1 this message may be logged later this message should be logged Message.tests.cpp:<line number> </failure> - <failure message="2 == 0" type="CHECK"> + <failure message="a == 0" type="CHECK"> +FAILED: + CHECK( a == 0 ) +with expansion: + 2 == 0 this message may be logged later this message should be logged and this, but later @@ -473,26 +704,50 @@ Message.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="INFO is reset for each loop" time="{duration}"> - <failure message="10 < 10" type="REQUIRE"> + <failure message="i < 10" type="REQUIRE"> +FAILED: + REQUIRE( i < 10 ) +with expansion: + 10 < 10 current counter 10 i := 10 Message.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Inequality checks that should fail" time="{duration}"> - <failure message="7 != 7" type="CHECK"> + <failure message="data.int_seven != 7" type="CHECK"> +FAILED: + CHECK( data.int_seven != 7 ) +with expansion: + 7 != 7 Condition.tests.cpp:<line number> </failure> - <failure message="9.1f != Approx( 9.1000003815 )" type="CHECK"> + <failure message="data.float_nine_point_one != Approx( 9.1f )" type="CHECK"> +FAILED: + CHECK( data.float_nine_point_one != Approx( 9.1f ) ) +with expansion: + 9.1f != Approx( 9.1000003815 ) Condition.tests.cpp:<line number> </failure> - <failure message="3.1415926535 != Approx( 3.1415926535 )" type="CHECK"> + <failure message="data.double_pi != Approx( 3.1415926535 )" type="CHECK"> +FAILED: + CHECK( data.double_pi != Approx( 3.1415926535 ) ) +with expansion: + 3.1415926535 != Approx( 3.1415926535 ) Condition.tests.cpp:<line number> </failure> - <failure message=""hello" != "hello"" type="CHECK"> + <failure message="data.str_hello != "hello"" type="CHECK"> +FAILED: + CHECK( data.str_hello != "hello" ) +with expansion: + "hello" != "hello" Condition.tests.cpp:<line number> </failure> - <failure message="5 != 5" type="CHECK"> + <failure message="data.str_hello.size() != 5" type="CHECK"> +FAILED: + CHECK( data.str_hello.size() != 5 ) +with expansion: + 5 != 5 Condition.tests.cpp:<line number> </failure> </testcase> @@ -503,18 +758,31 @@ Condition.tests.cpp:<line number> <testcase classname="<exe-name>.global" name="Matchers can be (AnyOf) composed with the || operator" time="{duration}"/> <testcase classname="<exe-name>.global" name="Matchers can be composed with both && and ||" time="{duration}"/> <testcase classname="<exe-name>.global" name="Matchers can be composed with both && and || - failing" time="{duration}"> - <failure message=""this string contains 'abc' as a substring" ( ( contains: "string" or contains: "different" ) and contains: "random" )" type="CHECK_THAT"> + <failure message="testStringForMatching(), (Contains("string") || Contains("different")) && Contains("random")" type="CHECK_THAT"> +FAILED: + CHECK_THAT( testStringForMatching(), (Contains("string") || Contains("different")) && Contains("random") ) +with expansion: + "this string contains 'abc' as a substring" ( ( contains: "string" or + contains: "different" ) and contains: "random" ) Matchers.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Matchers can be negated (Not) with the ! operator" time="{duration}"/> |