From 2c9e9ac004ead78e648390cd6bfacdeb23559e46 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Tue, 20 May 2014 18:28:19 +0100 Subject: [PATCH] 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 --- include/internal/catch_commandline.hpp | 2 +- include/internal/catch_test_spec_parser.hpp | 2 +- projects/SelfTest/CmdLineTests.cpp | 7 +++++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/include/internal/catch_commandline.hpp b/include/internal/catch_commandline.hpp index 05e9f46b..baed9c81 100644 --- a/include/internal/catch_commandline.hpp +++ b/include/internal/catch_commandline.hpp @@ -49,7 +49,7 @@ namespace Catch { while( std::getline( f, line ) ) { line = trim(line); if( !line.empty() && !startsWith( line, "#" ) ) - addTestOrTags( config, "\"" + line + "\"" ); + addTestOrTags( config, "\"" + line + "\"," ); } } diff --git a/include/internal/catch_test_spec_parser.hpp b/include/internal/catch_test_spec_parser.hpp index 53c724b9..6fc356e8 100644 --- a/include/internal/catch_test_spec_parser.hpp +++ b/include/internal/catch_test_spec_parser.hpp @@ -36,10 +36,10 @@ namespace Catch { visitChar( m_arg[m_pos] ); if( m_mode == Name ) addPattern(); - addFilter(); return *this; } TestSpec testSpec() { + addFilter(); return m_testSpec; } private: diff --git a/projects/SelfTest/CmdLineTests.cpp b/projects/SelfTest/CmdLineTests.cpp index beb831cc..a667ce33 100644 --- a/projects/SelfTest/CmdLineTests.cpp +++ b/projects/SelfTest/CmdLineTests.cpp @@ -148,6 +148,13 @@ TEST_CASE( "Parse test names and tags", "" ) { CHECK( spec.matches( tcB ) == false ); 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" ) { TestSpec spec = parseTestSpec( "*name*[x]" ); CHECK( spec.hasFilters() == true );