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

summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorPhil Nash2013-05-28 19:07:29 +0100
committerPhil Nash2013-05-28 19:07:29 +0100
commit6b8837bd9360f26c03112ce4e104ec7aa96b264d (patch)
tree898d63c772e3817fdc45b6ba9494ad73a1b8335d /include
parent43fe6c6e9edae209947101295edcf0e9e217716c (diff)
downloadcatch3-6b8837bd9360f26c03112ce4e104ec7aa96b264d.tar.gz
Final refactoring to remove direct access to encapsulated ConfigData once in Config
Diffstat (limited to 'include')
-rw-r--r--include/catch_runner.hpp10
-rw-r--r--include/internal/catch_config.hpp16
2 files changed, 14 insertions, 12 deletions
diff --git a/include/catch_runner.hpp b/include/catch_runner.hpp
index 1dfd21fc..b0cef9be 100644
--- a/include/catch_runner.hpp
+++ b/include/catch_runner.hpp
@@ -33,7 +33,7 @@ namespace Catch {
Totals runTests() {
- std::vector<TestCaseFilters> filterGroups = m_config->data().filters;
+ std::vector<TestCaseFilters> filterGroups = m_config->filters();
if( filterGroups.empty() ) {
TestCaseFilters filterGroup( "" );
filterGroups.push_back( filterGroup );
@@ -76,8 +76,8 @@ namespace Catch {
private:
void openStream() {
- if( !m_config->data().stream.empty() )
- m_config->useStream( m_config->data().stream );
+ if( !m_config->getStreamName().empty() )
+ m_config->useStream( m_config->getStreamName() );
// Open output file, if specified
if( !m_config->getFilename().empty() ) {
@@ -91,9 +91,9 @@ namespace Catch {
}
}
void makeReporter() {
- std::string reporterName = m_config->data().reporter.empty()
+ std::string reporterName = m_config->getReporterName().empty()
? "console"
- : m_config->data().reporter;
+ : m_config->getReporterName();
m_reporter = getRegistryHub().getReporterRegistry().create( reporterName, m_config.get() );
if( !m_reporter ) {
diff --git a/include/internal/catch_config.hpp b/include/internal/catch_config.hpp
index 11e1e86d..baaad59f 100644
--- a/include/internal/catch_config.hpp
+++ b/include/internal/catch_config.hpp
@@ -88,7 +88,8 @@ namespace Catch {
Config( ConfigData const& data )
: m_data( data ),
- m_os( std::cout.rdbuf() )
+ m_os( std::cout.rdbuf() ),
+ m_filters( data.filters )
{}
virtual ~Config() {
@@ -134,6 +135,10 @@ namespace Catch {
m_stream.release();
m_stream = stream;
}
+
+ std::string getStreamName() const { return m_data.stream; }
+
+ std::string getReporterName() const { return m_data.reporter; }
void addTestSpec( std::string const& testSpec ) {
TestCaseFilters filters( testSpec );
@@ -145,11 +150,8 @@ namespace Catch {
return m_data.cutoff;
}
- ConfigData const& data() const {
- return m_data;
- }
- ConfigData& data() {
- return m_data;
+ std::vector<TestCaseFilters> const& filters() const {
+ return m_filters;
}
// IConfig interface
@@ -162,9 +164,9 @@ namespace Catch {
private:
ConfigData m_data;
- // !TBD Move these out of here
Stream m_stream;
mutable std::ostream m_os;
+ std::vector<TestCaseFilters> m_filters;
};