From b5020fefd1d43a0ccd765c606af1ab1a16e2a80e Mon Sep 17 00:00:00 2001 From: Softonik Date: Mon, 16 Jun 2025 04:22:57 +0300 Subject: [PATCH] =?UTF-8?q?+=20=20=D0=A2=D0=B5=D1=81=D1=82=D1=8B=20=D1=81?= =?UTF-8?q?=20x-=D1=82=D0=B5=D0=B3=D0=BE=D0=BC=20=D0=BF=D1=80=D0=BE=D0=BF?= =?UTF-8?q?=D1=83=D1=81=D0=BA=D0=B0=D1=8E=D1=82=D1=81=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- features/tags.feature | 84 ++++++++++++++++++++++++------------- internal/tags/tag_filter.go | 13 +++++- 2 files changed, 68 insertions(+), 29 deletions(-) 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 +}