Last changes to ConfigData names (for now)

This commit is contained in:
Phil Nash 2013-05-31 08:01:56 +01:00
parent 40e529740c
commit c9f0f55451
4 changed files with 42 additions and 42 deletions

View File

@ -379,7 +379,7 @@ namespace Catch {
} }
virtual void parseIntoConfig( Command const& cmd, ConfigData& config ) { virtual void parseIntoConfig( Command const& cmd, ConfigData& config ) {
config.reporter = cmd[0]; config.reporterName = cmd[0];
} }
}; };
@ -530,7 +530,7 @@ namespace Catch {
if( ss.fail() || threshold <= 0 ) if( ss.fail() || threshold <= 0 )
cmd.raiseError( "threshold must be a number greater than zero" ); cmd.raiseError( "threshold must be a number greater than zero" );
} }
config.cutoff = threshold; config.abortAfter = threshold;
} }
}; };

View File

@ -45,7 +45,7 @@ namespace Catch {
shouldDebugBreak( false ), shouldDebugBreak( false ),
noThrow( false ), noThrow( false ),
showHelp( false ), showHelp( false ),
cutoff( -1 ), abortAfter( -1 ),
verbosity( Verbosity::Normal ), verbosity( Verbosity::Normal ),
warnings( WarnAbout::Nothing ) warnings( WarnAbout::Nothing )
{} {}
@ -59,12 +59,12 @@ namespace Catch {
bool noThrow; bool noThrow;
bool showHelp; bool showHelp;
int cutoff; int abortAfter;
Verbosity::Level verbosity; Verbosity::Level verbosity;
WarnAbout::What warnings; WarnAbout::What warnings;
std::string reporter; std::string reporterName;
std::string outputFilename; std::string outputFilename;
std::string name; std::string name;
@ -140,16 +140,16 @@ namespace Catch {
m_stream = stream; m_stream = stream;
} }
std::string getReporterName() const { return m_data.reporter; } std::string getReporterName() const { return m_data.reporterName; }
void addTestSpec( std::string const& testSpec ) { void addTestSpec( std::string const& testSpec ) {
TestCaseFilters filters( testSpec ); TestCaseFilters filters( testSpec );
filters.addFilter( TestCaseFilter( testSpec ) ); filters.addFilter( TestCaseFilter( testSpec ) );
m_filterSets.push_back( filters ); m_filterSets.push_back( filters );
} }
int abortAfter() const { int abortAfter() const {
return m_data.cutoff; return m_data.abortAfter;
} }
std::vector<TestCaseFilters> const& filters() const { std::vector<TestCaseFilters> const& filters() const {

View File

@ -3558,7 +3558,7 @@ with expansion:
TestMain.cpp:101: TestMain.cpp:101:
PASSED: PASSED:
CHECK( config.cutoff == -1 ) CHECK( config.abortAfter == -1 )
with expansion: with expansion:
-1 == -1 -1 == -1
@ -3570,7 +3570,7 @@ with expansion:
TestMain.cpp:103: TestMain.cpp:103:
PASSED: PASSED:
CHECK( config.reporter.empty() ) CHECK( config.reporterName.empty() )
with expansion: with expansion:
true true
@ -3789,7 +3789,7 @@ PASSED:
TestMain.cpp:178: TestMain.cpp:178:
PASSED: PASSED:
REQUIRE( config.reporter == "console" ) REQUIRE( config.reporterName == "console" )
with expansion: with expansion:
"console" == "console" "console" == "console"
@ -3807,7 +3807,7 @@ PASSED:
TestMain.cpp:184: TestMain.cpp:184:
PASSED: PASSED:
REQUIRE( config.reporter == "xml" ) REQUIRE( config.reporterName == "xml" )
with expansion: with expansion:
"xml" == "xml" "xml" == "xml"
@ -3825,7 +3825,7 @@ PASSED:
TestMain.cpp:190: TestMain.cpp:190:
PASSED: PASSED:
REQUIRE( config.reporter == "junit" ) REQUIRE( config.reporterName == "junit" )
with expansion: with expansion:
"junit" == "junit" "junit" == "junit"
@ -3909,7 +3909,7 @@ PASSED:
TestMain.cpp:222: TestMain.cpp:222:
PASSED: PASSED:
REQUIRE( config.cutoff == 1 ) REQUIRE( config.abortAfter == 1 )
with expansion: with expansion:
1 == 1 1 == 1
@ -3927,7 +3927,7 @@ PASSED:
TestMain.cpp:228: TestMain.cpp:228:
PASSED: PASSED:
REQUIRE( config.cutoff == 2 ) REQUIRE( config.abortAfter == 2 )
with expansion: with expansion:
2 == 2 2 == 2
@ -4062,7 +4062,7 @@ PASSED:
TestMain.cpp:279: TestMain.cpp:279:
PASSED: PASSED:
CHECK( config.cutoff == 1 ) CHECK( config.abortAfter == 1 )
with expansion: with expansion:
1 == 1 1 == 1
@ -10598,7 +10598,7 @@ TestMain.cpp" line="100">
</Expression> </Expression>
TestMain.cpp" line="101"> TestMain.cpp" line="101">
<Original> <Original>
config.cutoff == -1 config.abortAfter == -1
</Original> </Original>
<Expanded> <Expanded>
-1 == -1 -1 == -1
@ -10614,7 +10614,7 @@ TestMain.cpp" line="102">
</Expression> </Expression>
TestMain.cpp" line="103"> TestMain.cpp" line="103">
<Original> <Original>
config.reporter.empty() config.reporterName.empty()
</Original> </Original>
<Expanded> <Expanded>
true true
@ -10887,7 +10887,7 @@ TestMain.cpp" line="176">
</Expression> </Expression>
TestMain.cpp" line="178"> TestMain.cpp" line="178">
<Original> <Original>
config.reporter == &quot;console&quot; config.reporterName == &quot;console&quot;
</Original> </Original>
<Expanded> <Expanded>
&quot;console&quot; == &quot;console&quot; &quot;console&quot; == &quot;console&quot;
@ -10909,7 +10909,7 @@ TestMain.cpp" line="182">
</Expression> </Expression>
TestMain.cpp" line="184"> TestMain.cpp" line="184">
<Original> <Original>
config.reporter == &quot;xml&quot; config.reporterName == &quot;xml&quot;
</Original> </Original>
<Expanded> <Expanded>
&quot;xml&quot; == &quot;xml&quot; &quot;xml&quot; == &quot;xml&quot;
@ -10931,7 +10931,7 @@ TestMain.cpp" line="188">
</Expression> </Expression>
TestMain.cpp" line="190"> TestMain.cpp" line="190">
<Original> <Original>
config.reporter == &quot;junit&quot; config.reporterName == &quot;junit&quot;
</Original> </Original>
<Expanded> <Expanded>
&quot;junit&quot; == &quot;junit&quot; &quot;junit&quot; == &quot;junit&quot;
@ -11031,7 +11031,7 @@ TestMain.cpp" line="220">
</Expression> </Expression>
TestMain.cpp" line="222"> TestMain.cpp" line="222">
<Original> <Original>
config.cutoff == 1 config.abortAfter == 1
</Original> </Original>
<Expanded> <Expanded>
1 == 1 1 == 1
@ -11053,7 +11053,7 @@ TestMain.cpp" line="226">
</Expression> </Expression>
TestMain.cpp" line="228"> TestMain.cpp" line="228">
<Original> <Original>
config.cutoff == 2 config.abortAfter == 2
</Original> </Original>
<Expanded> <Expanded>
2 == 2 2 == 2
@ -11092,7 +11092,7 @@ TestMain.cpp" line="236">
<OverallResults successes="1" failures="0"/> <OverallResults successes="1" failures="0"/>
</Section> </Section>
<Section name="abort"> <Section name="abort">
<Section name="-a/error/two args" description="cutoff only takes one argument"> <Section name="-a/error/two args" description="abortAfter only takes one argument">
TestMain.cpp" line="240"> TestMain.cpp" line="240">
<Original> <Original>
parseIntoConfigAndReturnError( argv, config ) Contains( &quot;0 and 1 argument&quot; ) parseIntoConfigAndReturnError( argv, config ) Contains( &quot;0 and 1 argument&quot; )
@ -11214,7 +11214,7 @@ TestMain.cpp" line="277">
</Expression> </Expression>
TestMain.cpp" line="279"> TestMain.cpp" line="279">
<Original> <Original>
config.cutoff == 1 config.abortAfter == 1
</Original> </Original>
<Expanded> <Expanded>
1 == 1 1 == 1
@ -14189,9 +14189,9 @@ TestMain.cpp:59: totals.assertions.failed == 1 succeeded for: 1 == 1
[Started section: 'default'] [Started section: 'default']
TestMain.cpp:98: parseIntoConfig( argv, config ) succeeded TestMain.cpp:98: parseIntoConfig( argv, config ) succeeded
TestMain.cpp:100: config.shouldDebugBreak == false succeeded for: false == false TestMain.cpp:100: config.shouldDebugBreak == false succeeded for: false == false
TestMain.cpp:101: config.cutoff == -1 succeeded for: -1 == -1 TestMain.cpp:101: config.abortAfter == -1 succeeded for: -1 == -1
TestMain.cpp:102: config.noThrow == false succeeded for: false == false TestMain.cpp:102: config.noThrow == false succeeded for: false == false
TestMain.cpp:103: config.reporter.empty() succeeded for: true TestMain.cpp:103: config.reporterName.empty() succeeded for: true
[End of section: 'default' All 5 assertions passed] [End of section: 'default' All 5 assertions passed]
[Started section: 'test lists'] [Started section: 'test lists']
@ -14266,7 +14266,7 @@ TestMain.cpp:169: parseIntoConfigAndReturnError( argv, config ) Contains( "at le
[Started section: 'reporter'] [Started section: 'reporter']
[Started section: '-r/console'] [Started section: '-r/console']
TestMain.cpp:176: parseIntoConfig( argv, config ) succeeded TestMain.cpp:176: parseIntoConfig( argv, config ) succeeded
TestMain.cpp:178: config.reporter == "console" succeeded for: "console" == "console" TestMain.cpp:178: config.reporterName == "console" succeeded for: "console" == "console"
[End of section: '-r/console' All 2 assertions passed] [End of section: '-r/console' All 2 assertions passed]
[End of section: 'reporter' All 2 assertions passed] [End of section: 'reporter' All 2 assertions passed]
@ -14274,7 +14274,7 @@ TestMain.cpp:178: config.reporter == "console" succeeded for: "console" == "cons
[Started section: 'reporter'] [Started section: 'reporter']
[Started section: '-r/xml'] [Started section: '-r/xml']
TestMain.cpp:182: parseIntoConfig( argv, config ) succeeded TestMain.cpp:182: parseIntoConfig( argv, config ) succeeded
TestMain.cpp:184: config.reporter == "xml" succeeded for: "xml" == "xml" TestMain.cpp:184: config.reporterName == "xml" succeeded for: "xml" == "xml"
[End of section: '-r/xml' All 2 assertions passed] [End of section: '-r/xml' All 2 assertions passed]
[End of section: 'reporter' All 2 assertions passed] [End of section: 'reporter' All 2 assertions passed]
@ -14282,7 +14282,7 @@ TestMain.cpp:184: config.reporter == "xml" succeeded for: "xml" == "xml"
[Started section: 'reporter'] [Started section: 'reporter']
[Started section: '--reporter/junit'] [Started section: '--reporter/junit']
TestMain.cpp:188: parseIntoConfig( argv, config ) succeeded TestMain.cpp:188: parseIntoConfig( argv, config ) succeeded
TestMain.cpp:190: config.reporter == "junit" succeeded for: "junit" == "junit" TestMain.cpp:190: config.reporterName == "junit" succeeded for: "junit" == "junit"
[End of section: '--reporter/junit' All 2 assertions passed] [End of section: '--reporter/junit' All 2 assertions passed]
[End of section: 'reporter' All 2 assertions passed] [End of section: 'reporter' All 2 assertions passed]
@ -14322,7 +14322,7 @@ TestMain.cpp:213: parseIntoConfigAndReturnError( argv, config ) Contains( "0 arg
[Started section: 'abort'] [Started section: 'abort']
[Started section: '-a'] [Started section: '-a']
TestMain.cpp:220: parseIntoConfig( argv, config ) succeeded TestMain.cpp:220: parseIntoConfig( argv, config ) succeeded
TestMain.cpp:222: config.cutoff == 1 succeeded for: 1 == 1 TestMain.cpp:222: config.abortAfter == 1 succeeded for: 1 == 1
[End of section: '-a' All 2 assertions passed] [End of section: '-a' All 2 assertions passed]
[End of section: 'abort' All 2 assertions passed] [End of section: 'abort' All 2 assertions passed]
@ -14330,7 +14330,7 @@ TestMain.cpp:222: config.cutoff == 1 succeeded for: 1 == 1
[Started section: 'abort'] [Started section: 'abort']
[Started section: '-a/2'] [Started section: '-a/2']
TestMain.cpp:226: parseIntoConfig( argv, config ) succeeded TestMain.cpp:226: parseIntoConfig( argv, config ) succeeded
TestMain.cpp:228: config.cutoff == 2 succeeded for: 2 == 2 TestMain.cpp:228: config.abortAfter == 2 succeeded for: 2 == 2
[End of section: '-a/2' All 2 assertions passed] [End of section: '-a/2' All 2 assertions passed]
[End of section: 'abort' All 2 assertions passed] [End of section: 'abort' All 2 assertions passed]
@ -14394,7 +14394,7 @@ TestMain.cpp:270: config.outputFilename == "filename.ext" succeeded for: "filena
[Started section: 'combinations'] [Started section: 'combinations']
[Started section: '-a -b'] [Started section: '-a -b']
TestMain.cpp:277: parseIntoConfig( argv, config ) succeeded TestMain.cpp:277: parseIntoConfig( argv, config ) succeeded
TestMain.cpp:279: config.cutoff == 1 succeeded for: 1 == 1 TestMain.cpp:279: config.abortAfter == 1 succeeded for: 1 == 1
TestMain.cpp:280: config.shouldDebugBreak succeeded for: true TestMain.cpp:280: config.shouldDebugBreak succeeded for: true
TestMain.cpp:281: config.noThrow == true succeeded for: true == true TestMain.cpp:281: config.noThrow == true succeeded for: true == true
[End of section: '-a -b' All 4 assertions passed] [End of section: '-a -b' All 4 assertions passed]

View File

@ -98,9 +98,9 @@ TEST_CASE( "selftest/parser/2", "ConfigData" ) {
CHECK_NOTHROW( parseIntoConfig( argv, config ) ); CHECK_NOTHROW( parseIntoConfig( argv, config ) );
CHECK( config.shouldDebugBreak == false ); CHECK( config.shouldDebugBreak == false );
CHECK( config.cutoff == -1 ); CHECK( config.abortAfter == -1 );
CHECK( config.noThrow == false ); CHECK( config.noThrow == false );
CHECK( config.reporter.empty() ); CHECK( config.reporterName.empty() );
} }
SECTION( "test lists", "" ) { SECTION( "test lists", "" ) {
@ -175,19 +175,19 @@ TEST_CASE( "selftest/parser/2", "ConfigData" ) {
const char* argv[] = { "test", "-r", "console" }; const char* argv[] = { "test", "-r", "console" };
CHECK_NOTHROW( parseIntoConfig( argv, config ) ); CHECK_NOTHROW( parseIntoConfig( argv, config ) );
REQUIRE( config.reporter == "console" ); REQUIRE( config.reporterName == "console" );
} }
SECTION( "-r/xml", "" ) { SECTION( "-r/xml", "" ) {
const char* argv[] = { "test", "-r", "xml" }; const char* argv[] = { "test", "-r", "xml" };
CHECK_NOTHROW( parseIntoConfig( argv, config ) ); CHECK_NOTHROW( parseIntoConfig( argv, config ) );
REQUIRE( config.reporter == "xml" ); REQUIRE( config.reporterName == "xml" );
} }
SECTION( "--reporter/junit", "" ) { SECTION( "--reporter/junit", "" ) {
const char* argv[] = { "test", "--reporter", "junit" }; const char* argv[] = { "test", "--reporter", "junit" };
CHECK_NOTHROW( parseIntoConfig( argv, config ) ); CHECK_NOTHROW( parseIntoConfig( argv, config ) );
REQUIRE( config.reporter == "junit" ); REQUIRE( config.reporterName == "junit" );
} }
SECTION( "-r/error", "reporter config only accepts one argument" ) { SECTION( "-r/error", "reporter config only accepts one argument" ) {
const char* argv[] = { "test", "-r", "one", "two" }; const char* argv[] = { "test", "-r", "one", "two" };
@ -219,13 +219,13 @@ TEST_CASE( "selftest/parser/2", "ConfigData" ) {
const char* argv[] = { "test", "-a" }; const char* argv[] = { "test", "-a" };
CHECK_NOTHROW( parseIntoConfig( argv, config ) ); CHECK_NOTHROW( parseIntoConfig( argv, config ) );
REQUIRE( config.cutoff == 1 ); REQUIRE( config.abortAfter == 1 );
} }
SECTION( "-a/2", "" ) { SECTION( "-a/2", "" ) {
const char* argv[] = { "test", "-a", "2" }; const char* argv[] = { "test", "-a", "2" };
CHECK_NOTHROW( parseIntoConfig( argv, config ) ); CHECK_NOTHROW( parseIntoConfig( argv, config ) );
REQUIRE( config.cutoff == 2 ); REQUIRE( config.abortAfter == 2 );
} }
SECTION( "-a/error/0", "" ) { SECTION( "-a/error/0", "" ) {
const char* argv[] = { "test", "-a", "0" }; const char* argv[] = { "test", "-a", "0" };
@ -235,7 +235,7 @@ TEST_CASE( "selftest/parser/2", "ConfigData" ) {
const char* argv[] = { "test", "-a", "oops" }; const char* argv[] = { "test", "-a", "oops" };
REQUIRE_THAT( parseIntoConfigAndReturnError( argv, config ), Contains( "greater than zero" ) ); REQUIRE_THAT( parseIntoConfigAndReturnError( argv, config ), Contains( "greater than zero" ) );
} }
SECTION( "-a/error/two args", "cutoff only takes one argument" ) { SECTION( "-a/error/two args", "abortAfter only takes one argument" ) {
const char* argv[] = { "test", "-a", "1", "2" }; const char* argv[] = { "test", "-a", "1", "2" };
REQUIRE_THAT( parseIntoConfigAndReturnError( argv, config ), Contains( "0 and 1 argument" ) ); REQUIRE_THAT( parseIntoConfigAndReturnError( argv, config ), Contains( "0 and 1 argument" ) );
} }
@ -276,7 +276,7 @@ TEST_CASE( "selftest/parser/2", "ConfigData" ) {
const char* argv[] = { "test", "-a", "-b", "-nt" }; const char* argv[] = { "test", "-a", "-b", "-nt" };
CHECK_NOTHROW( parseIntoConfig( argv, config ) ); CHECK_NOTHROW( parseIntoConfig( argv, config ) );
CHECK( config.cutoff == 1 ); CHECK( config.abortAfter == 1 );
CHECK( config.shouldDebugBreak ); CHECK( config.shouldDebugBreak );
CHECK( config.noThrow == true ); CHECK( config.noThrow == true );
} }