Fixed space separated lists of test specs

- they form an AND expression. They were forming an OR expression due to changes made to fix -f - so that had to be fixed differently
This commit is contained in:
Phil Nash 2014-05-20 18:28:19 +01:00
parent baf181f15d
commit 2c9e9ac004
3 changed files with 9 additions and 2 deletions

View File

@ -49,7 +49,7 @@ namespace Catch {
while( std::getline( f, line ) ) { while( std::getline( f, line ) ) {
line = trim(line); line = trim(line);
if( !line.empty() && !startsWith( line, "#" ) ) if( !line.empty() && !startsWith( line, "#" ) )
addTestOrTags( config, "\"" + line + "\"" ); addTestOrTags( config, "\"" + line + "\"," );
} }
} }

View File

@ -36,10 +36,10 @@ namespace Catch {
visitChar( m_arg[m_pos] ); visitChar( m_arg[m_pos] );
if( m_mode == Name ) if( m_mode == Name )
addPattern<TestSpec::NamePattern>(); addPattern<TestSpec::NamePattern>();
addFilter();
return *this; return *this;
} }
TestSpec testSpec() { TestSpec testSpec() {
addFilter();
return m_testSpec; return m_testSpec;
} }
private: private:

View File

@ -148,6 +148,13 @@ TEST_CASE( "Parse test names and tags", "" ) {
CHECK( spec.matches( tcB ) == false ); CHECK( spec.matches( tcB ) == false );
CHECK( spec.matches( tcC ) == true ); CHECK( spec.matches( tcC ) == true );
} }
SECTION( "Two tags, spare separated" ) {
TestSpec spec = parseTestSpec( "[two] [x]" );
CHECK( spec.hasFilters() == true );
CHECK( spec.matches( tcA ) == false );
CHECK( spec.matches( tcB ) == false );
CHECK( spec.matches( tcC ) == true );
}
SECTION( "Wildcarded name and tag" ) { SECTION( "Wildcarded name and tag" ) {
TestSpec spec = parseTestSpec( "*name*[x]" ); TestSpec spec = parseTestSpec( "*name*[x]" );
CHECK( spec.hasFilters() == true ); CHECK( spec.hasFilters() == true );