mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-22 21:36:11 +01:00
Completed IStreamingInterface abstraction with TestRunInfo and GroupInfo
This commit is contained in:
parent
b56aaf4c36
commit
2632dca81d
@ -43,6 +43,15 @@ namespace Catch
|
||||
bool shouldRedirectStdOut;
|
||||
};
|
||||
|
||||
struct TestRunInfo {
|
||||
TestRunInfo( std::string const& _name ) : name( _name ) {}
|
||||
std::string name;
|
||||
};
|
||||
struct GroupInfo {
|
||||
GroupInfo( std::string const& _name ) : name( _name ) {}
|
||||
std::string name;
|
||||
};
|
||||
|
||||
struct SectionInfo {
|
||||
SectionInfo( std::string const& _name,
|
||||
std::string const& _description,
|
||||
@ -109,31 +118,31 @@ namespace Catch
|
||||
};
|
||||
|
||||
struct TestGroupStats : SharedImpl<> {
|
||||
TestGroupStats( std::string const& _groupName,
|
||||
TestGroupStats( GroupInfo const& _groupInfo,
|
||||
Totals const& _totals,
|
||||
bool _aborting )
|
||||
: groupName( _groupName ),
|
||||
: groupInfo( _groupInfo ),
|
||||
totals( _totals ),
|
||||
aborting( _aborting )
|
||||
{}
|
||||
virtual ~TestGroupStats();
|
||||
|
||||
std::string groupName;
|
||||
GroupInfo groupInfo;
|
||||
Totals totals;
|
||||
bool aborting;
|
||||
};
|
||||
|
||||
struct TestRunStats : SharedImpl<> {
|
||||
TestRunStats( std::string const& _runName,
|
||||
TestRunStats( TestRunInfo const& _runInfo,
|
||||
Totals const& _totals,
|
||||
bool _aborting )
|
||||
: runName( _runName ),
|
||||
: runInfo( _runInfo ),
|
||||
totals( _totals ),
|
||||
aborting( _aborting )
|
||||
{}
|
||||
virtual ~TestRunStats();
|
||||
|
||||
std::string runName;
|
||||
TestRunInfo runInfo;
|
||||
Totals totals;
|
||||
bool aborting;
|
||||
};
|
||||
@ -143,8 +152,8 @@ namespace Catch
|
||||
virtual ~IStreamingReporter();
|
||||
virtual ReporterPreferences getPreferences() const = 0;
|
||||
|
||||
virtual void testRunStarting( std::string const& runName ) = 0;
|
||||
virtual void testGroupStarting( std::string const& groupName ) = 0;
|
||||
virtual void testRunStarting( TestRunInfo const& testRunInfo ) = 0;
|
||||
virtual void testGroupStarting( GroupInfo const& groupInfo ) = 0;
|
||||
|
||||
virtual void testCaseStarting( TestCaseInfo const& testInfo ) = 0;
|
||||
virtual void sectionStarting( SectionInfo const& sectionInfo ) = 0;
|
||||
@ -199,11 +208,11 @@ namespace Catch
|
||||
return prefs;
|
||||
}
|
||||
|
||||
virtual void testRunStarting( std::string const& ) {
|
||||
virtual void testRunStarting( TestRunInfo const& ) {
|
||||
m_legacyReporter->StartTesting();
|
||||
}
|
||||
virtual void testGroupStarting( std::string const& groupName ) {
|
||||
m_legacyReporter->StartGroup( groupName );
|
||||
virtual void testGroupStarting( GroupInfo const& groupInfo ) {
|
||||
m_legacyReporter->StartGroup( groupInfo.name );
|
||||
}
|
||||
virtual void testCaseStarting( TestCaseInfo const& testInfo ) {
|
||||
m_legacyReporter->StartTestCase( testInfo );
|
||||
@ -235,7 +244,7 @@ namespace Catch
|
||||
virtual void testGroupEnded( Ptr<TestGroupStats const> const& testGroupStats ) {
|
||||
if( testGroupStats->aborting )
|
||||
m_legacyReporter->Aborted();
|
||||
m_legacyReporter->EndGroup( testGroupStats->groupName, testGroupStats->totals );
|
||||
m_legacyReporter->EndGroup( testGroupStats->groupInfo.name, testGroupStats->totals );
|
||||
}
|
||||
virtual void testRunEnded( Ptr<TestRunStats const> const& testRunStats ) {
|
||||
m_legacyReporter->EndTesting( testRunStats->totals );
|
||||
|
@ -68,11 +68,11 @@ namespace Catch {
|
||||
m_context.setRunner( this );
|
||||
m_context.setConfig( &m_config );
|
||||
m_context.setResultCapture( this );
|
||||
m_reporter->testRunStarting( "" ); // !TBD - name
|
||||
m_reporter->testRunStarting( TestRunInfo( "" ) ); // !TBD - name
|
||||
}
|
||||
|
||||
virtual ~Runner() {
|
||||
m_reporter->testRunEnded( new TestRunStats( "", m_totals, aborting() ) ); // !TBD - name
|
||||
m_reporter->testRunEnded( new TestRunStats( TestRunInfo( "" ), m_totals, aborting() ) ); // !TBD - name
|
||||
m_context.setRunner( m_prevRunner );
|
||||
m_context.setConfig( NULL );
|
||||
m_context.setResultCapture( m_prevResultCapture );
|
||||
@ -80,10 +80,10 @@ namespace Catch {
|
||||
}
|
||||
|
||||
void testGroupStarting( std::string const& testSpec ) {
|
||||
m_reporter->testGroupStarting( testSpec );
|
||||
m_reporter->testGroupStarting( GroupInfo( testSpec ) );
|
||||
}
|
||||
void testGroupEnded( std::string const& testSpec, Totals const& totals ) {
|
||||
m_reporter->testGroupEnded( new TestGroupStats( testSpec, totals, aborting() ) );
|
||||
m_reporter->testGroupEnded( new TestGroupStats( GroupInfo( testSpec ), totals, aborting() ) );
|
||||
}
|
||||
|
||||
Totals runMatching( const std::string& testSpec ) {
|
||||
|
@ -35,8 +35,8 @@ namespace Catch {
|
||||
return ReporterPreferences();
|
||||
}
|
||||
|
||||
virtual void testRunStarting( std::string const& ) {}
|
||||
virtual void testGroupStarting( std::string const& ) {}
|
||||
virtual void testRunStarting( TestRunInfo const& ) {}
|
||||
virtual void testGroupStarting( GroupInfo const& ) {}
|
||||
virtual void testCaseStarting( TestCaseInfo const& ) {}
|
||||
virtual void sectionStarting( SectionInfo const& ) {}
|
||||
virtual void assertionStarting( AssertionInfo const& ) {}
|
||||
|
Loading…
Reference in New Issue
Block a user