diff --git a/features/tags.feature b/features/tags.feature index 55f2906..29702a9 100644 --- a/features/tags.feature +++ b/features/tags.feature @@ -7,20 +7,20 @@ Feature: tag filters Given a feature "normal.feature" file: """ Feature: outline - + Background: Given passing step And passing step without return - + Scenario Outline: parse a scenario Given a feature path "" When I parse features Then I should have scenario registered - + Examples: | path | num | | features/load.feature:3 | 0 | - + @used Examples: | path | num | @@ -40,19 +40,19 @@ Feature: tag filters Given a feature "normal.feature" file: """ Feature: tagged - + @x Scenario: one Given a feature path "one" - + @x Scenario: two Given a feature path "two" - + @x @y Scenario: three Given a feature path "three" - + @y Scenario: four Given a feature path "four" @@ -71,19 +71,19 @@ Feature: tag filters Given a feature "normal.feature" file: """ Feature: tagged - + @x Scenario: one Given a feature path "one" - + @x Scenario: two Given a feature path "two" - + @x @y Scenario: three Given a feature path "three" - + @y @z Scenario: four Given a feature path "four" @@ -101,19 +101,19 @@ Feature: tag filters Given a feature "normal.feature" file: """ Feature: tagged - + @x Scenario: one Given a feature path "one" - + @x Scenario: two Given a feature path "two" - + @x @y Scenario: three Given a feature path "three" - + @y @z Scenario: four Given a feature path "four" @@ -130,17 +130,17 @@ Feature: tag filters Given a feature "normal.feature" file: """ Feature: f-tagged - + Scenario: one Given a feature path "one" - + Scenario: two Given a feature path "two" - + @f Scenario: three Given a feature path "three" - + @f Scenario: four Given a feature path "four" @@ -158,17 +158,17 @@ Feature: tag filters Given a feature "normal.feature" file: """ Feature: f-tagged - + Scenario: one Given a feature path "one" - + Scenario: two Given a feature path "two" - + @f Scenario: three Given a feature path "three" - + @f Scenario: four Given a feature path "four" @@ -176,16 +176,16 @@ Feature: tag filters And a feature "another.feature" file: """ Feature: non-tagged - + Scenario: five Given a feature path "five" - + Scenario: six Given a feature path "six" - + Scenario: seven Given a feature path "seven" - + Scenario: eight Given a feature path "eight" """ @@ -197,3 +197,31 @@ Feature: tag filters a feature path "three" a feature path "four" """ + + Scenario: empty filter and scenarios with x-tag - are skipped + Given a feature "normal.feature" file: + """ + Feature: x-tagged + + Scenario: one + Given a feature path "one" + + Scenario: two + Given a feature path "two" + + @x + Scenario: three + Given a feature path "three" + + @x + Scenario: four + Given a feature path "four" + """ + When I run feature suite with tags "" + Then the suite should have passed + And I should have 2 scenario registered + And the following steps should be passed: + """ + a feature path "one" + a feature path "two" + """ diff --git a/internal/tags/tag_filter.go b/internal/tags/tag_filter.go index 29763c2..389cdc8 100644 --- a/internal/tags/tag_filter.go +++ b/internal/tags/tag_filter.go @@ -15,7 +15,7 @@ func ApplyTagFilter(filter string, pickles []*messages.Pickle) []*messages.Pickl return ff } - return pickles + return filterOutX(pickles) } var result = []*messages.Pickle{} @@ -77,3 +77,14 @@ func filterF(pickles []*messages.Pickle) []*messages.Pickle { return result } +func filterOutX(pickles []*messages.Pickle) []*messages.Pickle { + var result = []*messages.Pickle{} + + for _, pickle := range pickles { + if !contains(pickle.Tags, "x") { + result = append(result, pickle) + } + } + + return result +}