diff options
| author | Phil Nash | 2013-05-29 18:42:46 +0100 |
|---|---|---|
| committer | Phil Nash | 2013-05-29 18:42:46 +0100 |
| commit | c2ca80d9fb4d06e2893942bd061613115ade6bae (patch) | |
| tree | 9eb498e1655b64f95ebb3767e2e0d19dfcb5c3de /include | |
| parent | 3c3beb57c36b5d55c05f4af164f28d7fd76db249 (diff) | |
| download | catch3-c2ca80d9fb4d06e2893942bd061613115ade6bae.tar.gz | |
Config refactoring: split List enum into three bools
Diffstat (limited to 'include')
| -rw-r--r-- | include/internal/catch_commandline.hpp | 24 | ||||
| -rw-r--r-- | include/internal/catch_config.hpp | 36 |
2 files changed, 19 insertions, 41 deletions
diff --git a/include/internal/catch_commandline.hpp b/include/internal/catch_commandline.hpp index 2eda8912..e0cccd70 100644 --- a/include/internal/catch_commandline.hpp +++ b/include/internal/catch_commandline.hpp @@ -317,7 +317,7 @@ namespace Catch { class ListOptionParser : public OptionParser { public: - ListOptionParser() : OptionParser( 0, 2 ) { + ListOptionParser() : OptionParser( 0, 1 ) { m_optionNames.push_back( "-l" ); m_optionNames.push_back( "--list" ); } @@ -346,27 +346,21 @@ namespace Catch { } virtual void parseIntoConfig( Command const& cmd, ConfigData& config ) { - config.listSpec = List::Tests; if( cmd.argsCount() >= 1 ) { - if( cmd[0] == "all" ) - config.listSpec = List::All; + if( cmd[0] == "all" ) { + config.listTests = true; + config.listTags = true; + config.listReporters = true; + } else if( cmd[0] == "tests" ) - config.listSpec = List::Tests; + config.listTests = true; else if( cmd[0] == "tags" ) - config.listSpec = List::Tags; + config.listTags = true; else if( cmd[0] == "reporters" ) - config.listSpec = List::Reports; + config.listReporters = true; else cmd.raiseError( "Expected tests, reporters or tags" ); } - if( cmd.argsCount() >= 2 ) { - if( cmd[1] == "xml" ) - config.listSpec = static_cast<List::What>( config.listSpec | List::AsXml ); - else if( cmd[1] == "text" ) - config.listSpec = static_cast<List::What>( config.listSpec | List::AsText ); - else - cmd.raiseError( "Expected xml or text" ); - } } }; diff --git a/include/internal/catch_config.hpp b/include/internal/catch_config.hpp index 141ac437..9472a422 100644 --- a/include/internal/catch_config.hpp +++ b/include/internal/catch_config.hpp @@ -23,27 +23,6 @@ #endif namespace Catch { - - struct Include { enum WhichResults { - FailedOnly, - SuccessfulResults - }; }; - - struct List{ enum What { - None = 0, - - Reports = 1, - Tests = 2, - Tags = 4, - All = Reports | Tests | Tags, - - WhatMask = 0xf, - - AsText = 0x10, - AsXml = 0x20, - - AsMask = 0xf0 - }; }; struct ConfigData { @@ -52,13 +31,16 @@ namespace Catch { Quiet, Normal }; }; + struct WarnAbout { enum What { Nothing = 0x00, NoAssertions = 0x01 }; }; ConfigData() - : listSpec( List::None ), + : listTests( false ), + listTags( false ), + listReporters( false ), showSuccessfulTests( false ), shouldDebugBreak( false ), noThrow( false ), @@ -66,7 +48,9 @@ namespace Catch { warnings( WarnAbout::Nothing ) {} - List::What listSpec; // !TBD Split into bools + bool listTests; + bool listTags; + bool listReporters; bool showSuccessfulTests; bool shouldDebugBreak; bool noThrow; @@ -117,9 +101,9 @@ namespace Catch { return m_data.outputFilename ; } - bool listTests() const { return m_data.listSpec & List::Tests; } - bool listTags() const { return m_data.listSpec & List::Tags; } - bool listReporters() const { return m_data.listSpec & List::Reports; } + bool listTests() const { return m_data.listTests; } + bool listTags() const { return m_data.listTags; } + bool listReporters() const { return m_data.listReporters; } std::string getName() const { return m_data.name; |