mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-01 12:55:40 +02:00
Resolve reporter outside of Config
config now only only holds reporter name
This commit is contained in:
@@ -15,8 +15,7 @@
|
||||
#include <string>
|
||||
#include <limits>
|
||||
|
||||
struct TestData
|
||||
{
|
||||
struct TestData {
|
||||
TestData()
|
||||
: int_seven( 7 ),
|
||||
str_hello( "hello" ),
|
||||
@@ -30,6 +29,25 @@ struct TestData
|
||||
double double_pi;
|
||||
};
|
||||
|
||||
|
||||
struct TestDef {
|
||||
TestDef& operator + ( const std::string& ) {
|
||||
return *this;
|
||||
}
|
||||
TestDef& operator[]( const std::string& ) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
//TEST( "./succeeding/conditions/equality" + Description("nyaya") )
|
||||
//{
|
||||
// TEST_CASE( [Name("inner")] )
|
||||
// {
|
||||
//
|
||||
// }
|
||||
//}
|
||||
|
||||
// The "failing" tests all use the CHECK macro, which continues if the specific test fails.
|
||||
// This allows us to see all results, even if an earlier check fails
|
||||
|
||||
@@ -37,6 +55,10 @@ struct TestData
|
||||
TEST_CASE( "./succeeding/conditions/equality",
|
||||
"Equality checks that should succeed" )
|
||||
{
|
||||
|
||||
TestDef td;
|
||||
td + "hello" + "hello";
|
||||
|
||||
TestData data;
|
||||
|
||||
REQUIRE( data.int_seven == 7 );
|
||||
@@ -225,6 +247,21 @@ TEST_CASE( "./succeeding/conditions/negative ints",
|
||||
CHECK( minInt > 2u );
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
struct Ex
|
||||
{
|
||||
Ex( T ){}
|
||||
|
||||
bool operator == ( const T& ) const { return true; }
|
||||
T operator * ( const T& ) const { return T(); }
|
||||
};
|
||||
|
||||
TEST_CASE( "./succeeding/conditions/computed ints",
|
||||
"Comparisons between ints where one side is computed" )
|
||||
{
|
||||
CHECK( 54 == 6*9 );
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
|
||||
|
@@ -33,7 +33,7 @@ TEST_CASE( "selftest/main", "Runs all Catch self tests and checks their results"
|
||||
SECTION( "selftest/test counts/succeeding tests",
|
||||
"Number of 'succeeding' tests is fixed" ) {
|
||||
runner.runMatching( "./succeeding/*" );
|
||||
CHECK( runner.getTotals().assertions.passed == 284 );
|
||||
CHECK( runner.getTotals().assertions.passed == 285 );
|
||||
CHECK( runner.getTotals().assertions.failed == 0 );
|
||||
}
|
||||
|
||||
|
@@ -20,14 +20,11 @@ namespace Catch{
|
||||
Config config;
|
||||
config.setStreamBuf( oss.rdbuf() );
|
||||
|
||||
//if( reporter == "mock" ) // !TBD
|
||||
config.setReporter( m_reporter.get() );
|
||||
|
||||
std::size_t result;
|
||||
|
||||
// Scoped because Runner doesn't report EndTesting until its destructor
|
||||
{
|
||||
Runner runner( config, config.getReporter() );
|
||||
Runner runner( config, m_reporter.get() );
|
||||
result = runner.runMatching( rawTestSpec );
|
||||
m_totals = runner.getTotals();
|
||||
}
|
||||
|
Reference in New Issue
Block a user