mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-22 05:16:10 +01:00
parent
db9866677e
commit
38b05f1400
2
include/external/clara.h
vendored
2
include/external/clara.h
vendored
@ -927,7 +927,7 @@ namespace Clara {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::vector<Parser::Token> parseInto( std::vector<std::string> const& args, ConfigT& config ) const {
|
std::vector<Parser::Token> parseInto( std::vector<std::string> const& args, ConfigT& config ) const {
|
||||||
std::string processName = args[0];
|
std::string processName = args.empty() ? std::string() : args[0];
|
||||||
std::size_t lastSlash = processName.find_last_of( "/\\" );
|
std::size_t lastSlash = processName.find_last_of( "/\\" );
|
||||||
if( lastSlash != std::string::npos )
|
if( lastSlash != std::string::npos )
|
||||||
processName = processName.substr( lastSlash+1 );
|
processName = processName.substr( lastSlash+1 );
|
||||||
|
@ -916,5 +916,5 @@ with expansion:
|
|||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
test cases: 166 | 119 passed | 44 failed | 3 failed as expected
|
test cases: 166 | 119 passed | 44 failed | 3 failed as expected
|
||||||
assertions: 958 | 852 passed | 87 failed | 19 failed as expected
|
assertions: 961 | 855 passed | 87 failed | 19 failed as expected
|
||||||
|
|
||||||
|
@ -5871,6 +5871,23 @@ MessageTests.cpp:<line number>:
|
|||||||
warning:
|
warning:
|
||||||
toString(p): 0x<hex digits>
|
toString(p): 0x<hex digits>
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Process can be configured on command line
|
||||||
|
empty args don't cause a crash
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
TestMain.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
TestMain.cpp:<line number>:
|
||||||
|
PASSED:
|
||||||
|
CHECK_NOTHROW( parser.parseInto( std::vector<std::string>(), config ) )
|
||||||
|
|
||||||
|
TestMain.cpp:<line number>:
|
||||||
|
PASSED:
|
||||||
|
CHECK( config.processName == "" )
|
||||||
|
with expansion:
|
||||||
|
"" == ""
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Process can be configured on command line
|
Process can be configured on command line
|
||||||
default - no arguments
|
default - no arguments
|
||||||
@ -5882,6 +5899,12 @@ TestMain.cpp:<line number>:
|
|||||||
PASSED:
|
PASSED:
|
||||||
CHECK_NOTHROW( parseIntoConfig( argv, config ) )
|
CHECK_NOTHROW( parseIntoConfig( argv, config ) )
|
||||||
|
|
||||||
|
TestMain.cpp:<line number>:
|
||||||
|
PASSED:
|
||||||
|
CHECK( config.processName == "test" )
|
||||||
|
with expansion:
|
||||||
|
"test" == "test"
|
||||||
|
|
||||||
TestMain.cpp:<line number>:
|
TestMain.cpp:<line number>:
|
||||||
PASSED:
|
PASSED:
|
||||||
CHECK( config.shouldDebugBreak == false )
|
CHECK( config.shouldDebugBreak == false )
|
||||||
@ -9382,5 +9405,5 @@ PASSED:
|
|||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
test cases: 166 | 118 passed | 45 failed | 3 failed as expected
|
test cases: 166 | 118 passed | 45 failed | 3 failed as expected
|
||||||
assertions: 960 | 852 passed | 89 failed | 19 failed as expected
|
assertions: 963 | 855 passed | 89 failed | 19 failed as expected
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<testsuitesspanner>
|
<testsuitesspanner>
|
||||||
<testsuite name="<exe-name>" errors="13" failures="77" tests="961" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
|
<testsuite name="<exe-name>" errors="13" failures="77" tests="964" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
|
||||||
<testcase classname="global" name="# A test name that starts with a #" time="{duration}"/>
|
<testcase classname="global" name="# A test name that starts with a #" time="{duration}"/>
|
||||||
<testcase classname="global" name="#542" time="{duration}"/>
|
<testcase classname="global" name="#542" time="{duration}"/>
|
||||||
<testcase classname="global" name="#809" time="{duration}"/>
|
<testcase classname="global" name="#809" time="{duration}"/>
|
||||||
@ -400,6 +400,7 @@ MessageTests.cpp:<line number>
|
|||||||
<testcase classname="global" name="Parsing a std::pair" time="{duration}"/>
|
<testcase classname="global" name="Parsing a std::pair" time="{duration}"/>
|
||||||
<testcase classname="global" name="Pointers can be compared to null" time="{duration}"/>
|
<testcase classname="global" name="Pointers can be compared to null" time="{duration}"/>
|
||||||
<testcase classname="global" name="Pointers can be converted to strings" time="{duration}"/>
|
<testcase classname="global" name="Pointers can be converted to strings" time="{duration}"/>
|
||||||
|
<testcase classname="Process can be configured on command line" name="empty args don't cause a crash" time="{duration}"/>
|
||||||
<testcase classname="Process can be configured on command line" name="default - no arguments" time="{duration}"/>
|
<testcase classname="Process can be configured on command line" name="default - no arguments" time="{duration}"/>
|
||||||
<testcase classname="Process can be configured on command line" name="test lists/1 test" time="{duration}"/>
|
<testcase classname="Process can be configured on command line" name="test lists/1 test" time="{duration}"/>
|
||||||
<testcase classname="Process can be configured on command line" name="test lists/Specify one test case exclusion using exclude:" time="{duration}"/>
|
<testcase classname="Process can be configured on command line" name="test lists/Specify one test case exclusion using exclude:" time="{duration}"/>
|
||||||
|
@ -6215,6 +6215,25 @@ re>"
|
|||||||
<OverallResult success="true"/>
|
<OverallResult success="true"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<TestCase name="Process can be configured on command line" tags="[command-line][config]" filename="projects/<exe-name>/TestMain.cpp" >
|
<TestCase name="Process can be configured on command line" tags="[command-line][config]" filename="projects/<exe-name>/TestMain.cpp" >
|
||||||
|
<Section name="empty args don't cause a crash" filename="projects/<exe-name>/TestMain.cpp" >
|
||||||
|
<Expression success="true" type="CHECK_NOTHROW" filename="projects/<exe-name>/TestMain.cpp" >
|
||||||
|
<Original>
|
||||||
|
parser.parseInto( std::vector<std::string>(), config )
|
||||||
|
</Original>
|
||||||
|
<Expanded>
|
||||||
|
parser.parseInto( std::vector<std::string>(), config )
|
||||||
|
</Expanded>
|
||||||
|
</Expression>
|
||||||
|
<Expression success="true" type="CHECK" filename="projects/<exe-name>/TestMain.cpp" >
|
||||||
|
<Original>
|
||||||
|
config.processName == ""
|
||||||
|
</Original>
|
||||||
|
<Expanded>
|
||||||
|
"" == ""
|
||||||
|
</Expanded>
|
||||||
|
</Expression>
|
||||||
|
<OverallResults successes="2" failures="0" expectedFailures="0"/>
|
||||||
|
</Section>
|
||||||
<Section name="default - no arguments" filename="projects/<exe-name>/TestMain.cpp" >
|
<Section name="default - no arguments" filename="projects/<exe-name>/TestMain.cpp" >
|
||||||
<Expression success="true" type="CHECK_NOTHROW" filename="projects/<exe-name>/TestMain.cpp" >
|
<Expression success="true" type="CHECK_NOTHROW" filename="projects/<exe-name>/TestMain.cpp" >
|
||||||
<Original>
|
<Original>
|
||||||
@ -6224,6 +6243,14 @@ re>"
|
|||||||
parseIntoConfig( argv, config )
|
parseIntoConfig( argv, config )
|
||||||
</Expanded>
|
</Expanded>
|
||||||
</Expression>
|
</Expression>
|
||||||
|
<Expression success="true" type="CHECK" filename="projects/<exe-name>/TestMain.cpp" >
|
||||||
|
<Original>
|
||||||
|
config.processName == "test"
|
||||||
|
</Original>
|
||||||
|
<Expanded>
|
||||||
|
"test" == "test"
|
||||||
|
</Expanded>
|
||||||
|
</Expression>
|
||||||
<Expression success="true" type="CHECK" filename="projects/<exe-name>/TestMain.cpp" >
|
<Expression success="true" type="CHECK" filename="projects/<exe-name>/TestMain.cpp" >
|
||||||
<Original>
|
<Original>
|
||||||
config.shouldDebugBreak == false
|
config.shouldDebugBreak == false
|
||||||
@ -6256,7 +6283,7 @@ re>"
|
|||||||
true
|
true
|
||||||
</Expanded>
|
</Expanded>
|
||||||
</Expression>
|
</Expression>
|
||||||
<OverallResults successes="5" failures="0" expectedFailures="0"/>
|
<OverallResults successes="6" failures="0" expectedFailures="0"/>
|
||||||
</Section>
|
</Section>
|
||||||
<Section name="test lists" filename="projects/<exe-name>/TestMain.cpp" >
|
<Section name="test lists" filename="projects/<exe-name>/TestMain.cpp" >
|
||||||
<Section name="1 test" description="Specify one test case using" filename="projects/<exe-name>/TestMain.cpp" >
|
<Section name="1 test" description="Specify one test case using" filename="projects/<exe-name>/TestMain.cpp" >
|
||||||
@ -10016,7 +10043,7 @@ spanner <OverallResult success="true"/>
|
|||||||
</Section>
|
</Section>
|
||||||
<OverallResult success="true"/>
|
<OverallResult success="true"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<OverallResults successes="852" failures="90" expectedFailures="19"/>
|
<OverallResults successes="855" failures="90" expectedFailures="19"/>
|
||||||
</Group>
|
</Group>
|
||||||
<OverallResults successes="852" failures="89" expectedFailures="19"/>
|
<OverallResults successes="855" failures="89" expectedFailures="19"/>
|
||||||
</Catch>
|
</Catch>
|
||||||
|
@ -51,10 +51,18 @@ TEST_CASE( "Process can be configured on command line", "[config][command-line]"
|
|||||||
|
|
||||||
Catch::ConfigData config;
|
Catch::ConfigData config;
|
||||||
|
|
||||||
|
SECTION( "empty args don't cause a crash" ) {
|
||||||
|
Catch::Clara::CommandLine<Catch::ConfigData> parser = Catch::makeCommandLineParser();
|
||||||
|
CHECK_NOTHROW( parser.parseInto( std::vector<std::string>(), config ) );
|
||||||
|
|
||||||
|
CHECK( config.processName == "" );
|
||||||
|
}
|
||||||
|
|
||||||
SECTION( "default - no arguments", "" ) {
|
SECTION( "default - no arguments", "" ) {
|
||||||
const char* argv[] = { "test" };
|
const char* argv[] = { "test" };
|
||||||
CHECK_NOTHROW( parseIntoConfig( argv, config ) );
|
CHECK_NOTHROW( parseIntoConfig( argv, config ) );
|
||||||
|
|
||||||
|
CHECK( config.processName == "test" );
|
||||||
CHECK( config.shouldDebugBreak == false );
|
CHECK( config.shouldDebugBreak == false );
|
||||||
CHECK( config.abortAfter == -1 );
|
CHECK( config.abortAfter == -1 );
|
||||||
CHECK( config.noThrow == false );
|
CHECK( config.noThrow == false );
|
||||||
|
Loading…
Reference in New Issue
Block a user