mirror of https://github.com/catchorg/Catch2.git
Made SUCCESS variadic too (optional stream)
This commit is contained in:
parent
2851b4a55a
commit
557b3bdbe3
|
@ -72,7 +72,6 @@
|
||||||
|
|
||||||
#define CATCH_INFO( msg ) INTERNAL_CATCH_INFO( msg, "CATCH_INFO" )
|
#define CATCH_INFO( msg ) INTERNAL_CATCH_INFO( msg, "CATCH_INFO" )
|
||||||
#define CATCH_WARN( msg ) INTERNAL_CATCH_MSG( Catch::ResultWas::Warning, Catch::ResultDisposition::ContinueOnFailure, "CATCH_WARN", msg )
|
#define CATCH_WARN( msg ) INTERNAL_CATCH_MSG( Catch::ResultWas::Warning, Catch::ResultDisposition::ContinueOnFailure, "CATCH_WARN", msg )
|
||||||
#define CATCH_SUCCEED( msg ) INTERNAL_CATCH_MSG( Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, "CATCH_SUCCEED", msg )
|
|
||||||
#define CATCH_SCOPED_INFO( msg ) INTERNAL_CATCH_INFO( msg, "CATCH_INFO" )
|
#define CATCH_SCOPED_INFO( msg ) INTERNAL_CATCH_INFO( msg, "CATCH_INFO" )
|
||||||
#define CATCH_CAPTURE( msg ) INTERNAL_CATCH_INFO( #msg " := " << msg, "CATCH_CAPTURE" )
|
#define CATCH_CAPTURE( msg ) INTERNAL_CATCH_INFO( #msg " := " << msg, "CATCH_CAPTURE" )
|
||||||
#define CATCH_SCOPED_CAPTURE( msg ) INTERNAL_CATCH_INFO( #msg " := " << msg, "CATCH_CAPTURE" )
|
#define CATCH_SCOPED_CAPTURE( msg ) INTERNAL_CATCH_INFO( #msg " := " << msg, "CATCH_CAPTURE" )
|
||||||
|
@ -83,12 +82,14 @@
|
||||||
#define CATCH_METHOD_AS_TEST_CASE( method, ... ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, __VA_ARGS__ )
|
#define CATCH_METHOD_AS_TEST_CASE( method, ... ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, __VA_ARGS__ )
|
||||||
#define CATCH_SECTION( ... ) INTERNAL_CATCH_SECTION( __VA_ARGS__ )
|
#define CATCH_SECTION( ... ) INTERNAL_CATCH_SECTION( __VA_ARGS__ )
|
||||||
#define CATCH_FAIL( ... ) INTERNAL_CATCH_MSG( Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, "CATCH_FAIL", __VA_ARGS__ )
|
#define CATCH_FAIL( ... ) INTERNAL_CATCH_MSG( Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, "CATCH_FAIL", __VA_ARGS__ )
|
||||||
|
#define CATCH_SUCCEED( ... ) INTERNAL_CATCH_MSG( Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, "CATCH_SUCCEED", __VA_ARGS__ )
|
||||||
#else
|
#else
|
||||||
#define CATCH_TEST_CASE( name, description ) INTERNAL_CATCH_TESTCASE( name, description )
|
#define CATCH_TEST_CASE( name, description ) INTERNAL_CATCH_TESTCASE( name, description )
|
||||||
#define CATCH_TEST_CASE_METHOD( className, name, description ) INTERNAL_CATCH_TEST_CASE_METHOD( className, name, description )
|
#define CATCH_TEST_CASE_METHOD( className, name, description ) INTERNAL_CATCH_TEST_CASE_METHOD( className, name, description )
|
||||||
#define CATCH_METHOD_AS_TEST_CASE( method, name, description ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, name, description )
|
#define CATCH_METHOD_AS_TEST_CASE( method, name, description ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, name, description )
|
||||||
#define CATCH_SECTION( name, description ) INTERNAL_CATCH_SECTION( name, description )
|
#define CATCH_SECTION( name, description ) INTERNAL_CATCH_SECTION( name, description )
|
||||||
#define CATCH_FAIL( msg ) INTERNAL_CATCH_MSG( Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, "CATCH_FAIL", msg )
|
#define CATCH_FAIL( msg ) INTERNAL_CATCH_MSG( Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, "CATCH_FAIL", msg )
|
||||||
|
#define CATCH_SUCCEED( msg ) INTERNAL_CATCH_MSG( Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, "CATCH_SUCCEED", msg )
|
||||||
#endif
|
#endif
|
||||||
#define CATCH_ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE( "", "" )
|
#define CATCH_ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE( "", "" )
|
||||||
|
|
||||||
|
@ -134,7 +135,6 @@
|
||||||
|
|
||||||
#define INFO( msg ) INTERNAL_CATCH_INFO( msg, "INFO" )
|
#define INFO( msg ) INTERNAL_CATCH_INFO( msg, "INFO" )
|
||||||
#define WARN( msg ) INTERNAL_CATCH_MSG( Catch::ResultWas::Warning, Catch::ResultDisposition::ContinueOnFailure, "WARN", msg )
|
#define WARN( msg ) INTERNAL_CATCH_MSG( Catch::ResultWas::Warning, Catch::ResultDisposition::ContinueOnFailure, "WARN", msg )
|
||||||
#define SUCCEED( msg ) INTERNAL_CATCH_MSG( Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, "SUCCEED", msg )
|
|
||||||
#define SCOPED_INFO( msg ) INTERNAL_CATCH_INFO( msg, "INFO" )
|
#define SCOPED_INFO( msg ) INTERNAL_CATCH_INFO( msg, "INFO" )
|
||||||
#define CAPTURE( msg ) INTERNAL_CATCH_INFO( #msg " := " << msg, "CAPTURE" )
|
#define CAPTURE( msg ) INTERNAL_CATCH_INFO( #msg " := " << msg, "CAPTURE" )
|
||||||
#define SCOPED_CAPTURE( msg ) INTERNAL_CATCH_INFO( #msg " := " << msg, "CAPTURE" )
|
#define SCOPED_CAPTURE( msg ) INTERNAL_CATCH_INFO( #msg " := " << msg, "CAPTURE" )
|
||||||
|
@ -145,12 +145,14 @@
|
||||||
#define METHOD_AS_TEST_CASE( method, ... ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, __VA_ARGS__ )
|
#define METHOD_AS_TEST_CASE( method, ... ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, __VA_ARGS__ )
|
||||||
#define SECTION( ... ) INTERNAL_CATCH_SECTION( __VA_ARGS__ )
|
#define SECTION( ... ) INTERNAL_CATCH_SECTION( __VA_ARGS__ )
|
||||||
#define FAIL( ... ) INTERNAL_CATCH_MSG( Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, "FAIL", __VA_ARGS__ )
|
#define FAIL( ... ) INTERNAL_CATCH_MSG( Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, "FAIL", __VA_ARGS__ )
|
||||||
|
#define SUCCEED( ... ) INTERNAL_CATCH_MSG( Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, "SUCCEED", __VA_ARGS__ )
|
||||||
#else
|
#else
|
||||||
#define TEST_CASE( name, description ) INTERNAL_CATCH_TESTCASE( name, description )
|
#define TEST_CASE( name, description ) INTERNAL_CATCH_TESTCASE( name, description )
|
||||||
#define TEST_CASE_METHOD( className, name, description ) INTERNAL_CATCH_TEST_CASE_METHOD( className, name, description )
|
#define TEST_CASE_METHOD( className, name, description ) INTERNAL_CATCH_TEST_CASE_METHOD( className, name, description )
|
||||||
#define METHOD_AS_TEST_CASE( method, name, description ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, name, description )
|
#define METHOD_AS_TEST_CASE( method, name, description ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, name, description )
|
||||||
#define SECTION( name, description ) INTERNAL_CATCH_SECTION( name, description )
|
#define SECTION( name, description ) INTERNAL_CATCH_SECTION( name, description )
|
||||||
#define FAIL( msg ) INTERNAL_CATCH_MSG( Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, "FAIL", msg )
|
#define FAIL( msg ) INTERNAL_CATCH_MSG( Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, "FAIL", msg )
|
||||||
|
#define SUCCEED( msg ) INTERNAL_CATCH_MSG( Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, "SUCCEED", msg )
|
||||||
#endif
|
#endif
|
||||||
#define ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE( "", "" )
|
#define ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE( "", "" )
|
||||||
|
|
||||||
|
|
|
@ -750,5 +750,5 @@ with expansion:
|
||||||
"first" == "second"
|
"first" == "second"
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
121 test cases - 36 failed (674 assertions - 91 failed)
|
122 test cases - 36 failed (675 assertions - 91 failed)
|
||||||
|
|
||||||
|
|
|
@ -2580,6 +2580,15 @@ MessageTests.cpp:<line number>
|
||||||
|
|
||||||
MessageTests.cpp:<line number>: FAILED:
|
MessageTests.cpp:<line number>: FAILED:
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
SUCCESS does not require an argument
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
MessageTests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
MessageTests.cpp:<line number>:
|
||||||
|
PASSED:
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Output from all sections is reported
|
Output from all sections is reported
|
||||||
one
|
one
|
||||||
|
@ -7131,5 +7140,5 @@ with expansion:
|
||||||
true
|
true
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
121 test cases - 51 failed (693 assertions - 110 failed)
|
122 test cases - 51 failed (694 assertions - 110 failed)
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<testsuites>
|
<testsuites>
|
||||||
<testsuite name="~_" errors="10" failures="100" tests="693" hostname="tbd" time="{duration}" timestamp="tbd">
|
<testsuite name="~_" errors="10" failures="100" tests="694" hostname="tbd" time="{duration}" timestamp="tbd">
|
||||||
<testcase classname="global" name="Some simple comparisons between doubles" time="{duration}"/>
|
<testcase classname="global" name="Some simple comparisons between doubles" time="{duration}"/>
|
||||||
<testcase classname="global" name="Approximate comparisons with different epsilons" time="{duration}"/>
|
<testcase classname="global" name="Approximate comparisons with different epsilons" time="{duration}"/>
|
||||||
<testcase classname="global" name="Approximate comparisons with floats" time="{duration}"/>
|
<testcase classname="global" name="Approximate comparisons with floats" time="{duration}"/>
|
||||||
|
@ -267,6 +267,7 @@ MessageTests.cpp:<line number>
|
||||||
MessageTests.cpp:<line number>
|
MessageTests.cpp:<line number>
|
||||||
</failure>
|
</failure>
|
||||||
</testcase>
|
</testcase>
|
||||||
|
<testcase classname="global" name="SUCCESS does not require an argument" time="{duration}"/>
|
||||||
<testcase classname="Output from all sections is reported" name="one" time="{duration}">
|
<testcase classname="Output from all sections is reported" name="one" time="{duration}">
|
||||||
<failure type="FAIL">
|
<failure type="FAIL">
|
||||||
Message from section one
|
Message from section one
|
||||||
|
|
|
@ -2734,6 +2734,9 @@
|
||||||
<Failure/>
|
<Failure/>
|
||||||
<OverallResult success="false"/>
|
<OverallResult success="false"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
|
<TestCase name="SUCCESS does not require an argument">
|
||||||
|
<OverallResult success="true"/>
|
||||||
|
</TestCase>
|
||||||
<TestCase name="Output from all sections is reported">
|
<TestCase name="Output from all sections is reported">
|
||||||
<Section name="one">
|
<Section name="one">
|
||||||
<Failure>
|
<Failure>
|
||||||
|
@ -7402,7 +7405,7 @@ there"
|
||||||
</Section>
|
</Section>
|
||||||
<OverallResult success="true"/>
|
<OverallResult success="true"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<OverallResults successes="583" failures="110"/>
|
<OverallResults successes="584" failures="110"/>
|
||||||
</Group>
|
</Group>
|
||||||
<OverallResults successes="583" failures="110"/>
|
<OverallResults successes="584" failures="110"/>
|
||||||
</Catch>
|
</Catch>
|
||||||
|
|
|
@ -47,15 +47,17 @@ TEST_CASE( "INFO gets logged on failure, even if captured before successful asse
|
||||||
|
|
||||||
TEST_CASE( "FAIL aborts the test", "[failing][messages][.]" )
|
TEST_CASE( "FAIL aborts the test", "[failing][messages][.]" )
|
||||||
{
|
{
|
||||||
if( Catch::isTrue( true ) )
|
FAIL( "This is a " << "failure" ); // This should output the message and abort
|
||||||
FAIL( "This is a " << "failure" ); // This should output the message and abort
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CATCH_CONFIG_VARIADIC_MACROS
|
#ifdef CATCH_CONFIG_VARIADIC_MACROS
|
||||||
TEST_CASE( "FAIL does not require an argument", "[failing][messages][.]" )
|
TEST_CASE( "FAIL does not require an argument", "[failing][messages][.]" )
|
||||||
{
|
{
|
||||||
if( Catch::isTrue( true ) )
|
FAIL();
|
||||||
FAIL();
|
}
|
||||||
|
TEST_CASE( "SUCCESS does not require an argument", "[messages][.]" )
|
||||||
|
{
|
||||||
|
SUCCEED();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue