Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorPhil Nash2012-12-01 23:49:57 +0000
committerPhil Nash2012-12-01 23:49:57 +0000
commit2632dca81d84b30f014a5a7efca785fe345f322a (patch)
treec894444db5690246b8fdb8685927180a5389ed03 /include
parentb56aaf4c36c4593e1b768deb9d396a3fdef867ac (diff)
downloadcatch3-2632dca81d84b30f014a5a7efca785fe345f322a.tar.gz
Completed IStreamingInterface abstraction with TestRunInfo and GroupInfo
Diffstat (limited to 'include')
-rw-r--r--include/internal/catch_interfaces_reporter.h33
-rw-r--r--include/internal/catch_runner_impl.hpp8
2 files changed, 25 insertions, 16 deletions
diff --git a/include/internal/catch_interfaces_reporter.h b/include/internal/catch_interfaces_reporter.h
index 7c30d96c..fc272755 100644
--- a/include/internal/catch_interfaces_reporter.h
+++ b/include/internal/catch_interfaces_reporter.h
@@ -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 );
diff --git a/include/internal/catch_runner_impl.hpp b/include/internal/catch_runner_impl.hpp
index 850fa56f..8deb4f7d 100644
--- a/include/internal/catch_runner_impl.hpp
+++ b/include/internal/catch_runner_impl.hpp
@@ -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 ) {