mirror of
https://github.com/catchorg/Catch2.git
synced 2025-06-03 02:17:54 +00:00
Refactoring towards interface based config
This commit is contained in:
parent
10fa0593db
commit
e1459955f1
17 changed files with 754 additions and 245 deletions
|
@ -75,7 +75,7 @@ namespace Catch {
|
|||
};
|
||||
|
||||
|
||||
class Config : public IConfig {
|
||||
class Config : public SharedImpl<IConfig> {
|
||||
private:
|
||||
Config( Config const& other );
|
||||
Config& operator = ( Config const& other );
|
||||
|
@ -123,10 +123,6 @@ namespace Catch {
|
|||
bool shouldDebugBreak() const {
|
||||
return m_data.shouldDebugBreak;
|
||||
}
|
||||
|
||||
virtual std::ostream& stream() const {
|
||||
return m_os;
|
||||
}
|
||||
|
||||
void setStreamBuf( std::streambuf* buf ) {
|
||||
m_os.rdbuf( buf ? buf : std::cout.rdbuf() );
|
||||
|
@ -144,19 +140,11 @@ namespace Catch {
|
|||
filters.addFilter( TestCaseFilter( testSpec ) );
|
||||
m_data.filters.push_back( filters );
|
||||
}
|
||||
|
||||
virtual bool includeSuccessfulResults() const {
|
||||
return m_data.includeWhichResults == Include::SuccessfulResults;
|
||||
}
|
||||
|
||||
|
||||
int getCutoff() const {
|
||||
return m_data.cutoff;
|
||||
}
|
||||
|
||||
virtual bool allowThrows() const {
|
||||
return m_data.allowThrows;
|
||||
}
|
||||
|
||||
ConfigData const& data() const {
|
||||
return m_data;
|
||||
}
|
||||
|
@ -164,6 +152,13 @@ namespace Catch {
|
|||
return m_data;
|
||||
}
|
||||
|
||||
// IConfig interface
|
||||
virtual bool allowThrows() const { return m_data.allowThrows; }
|
||||
virtual std::ostream& stream() const { return m_os; }
|
||||
virtual std::string name() const { return m_data.name; }
|
||||
virtual bool includeSuccessfulResults() const { return m_data.includeWhichResults == Include::SuccessfulResults; }
|
||||
virtual bool warnAboutMissingAssertions() const { return m_data.warnings & ConfigData::WarnAbout::NoAssertions; }
|
||||
|
||||
private:
|
||||
ConfigData m_data;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue