+ Тесты с x-тегом пропускаются

Этот коммит содержится в:
Softonik 2025-06-16 04:22:57 +03:00
родитель b163beeff8
коммит b5020fefd1
2 изменённых файлов: 68 добавлений и 29 удалений

Просмотреть файл

@ -7,20 +7,20 @@ Feature: tag filters
Given a feature "normal.feature" file: Given a feature "normal.feature" file:
""" """
Feature: outline Feature: outline
Background: Background:
Given passing step Given passing step
And passing step without return And passing step without return
Scenario Outline: parse a scenario Scenario Outline: parse a scenario
Given a feature path "<path>" Given a feature path "<path>"
When I parse features When I parse features
Then I should have <num> scenario registered Then I should have <num> scenario registered
Examples: Examples:
| path | num | | path | num |
| features/load.feature:3 | 0 | | features/load.feature:3 | 0 |
@used @used
Examples: Examples:
| path | num | | path | num |
@ -40,19 +40,19 @@ Feature: tag filters
Given a feature "normal.feature" file: Given a feature "normal.feature" file:
""" """
Feature: tagged Feature: tagged
@x @x
Scenario: one Scenario: one
Given a feature path "one" Given a feature path "one"
@x @x
Scenario: two Scenario: two
Given a feature path "two" Given a feature path "two"
@x @y @x @y
Scenario: three Scenario: three
Given a feature path "three" Given a feature path "three"
@y @y
Scenario: four Scenario: four
Given a feature path "four" Given a feature path "four"
@ -71,19 +71,19 @@ Feature: tag filters
Given a feature "normal.feature" file: Given a feature "normal.feature" file:
""" """
Feature: tagged Feature: tagged
@x @x
Scenario: one Scenario: one
Given a feature path "one" Given a feature path "one"
@x @x
Scenario: two Scenario: two
Given a feature path "two" Given a feature path "two"
@x @y @x @y
Scenario: three Scenario: three
Given a feature path "three" Given a feature path "three"
@y @z @y @z
Scenario: four Scenario: four
Given a feature path "four" Given a feature path "four"
@ -101,19 +101,19 @@ Feature: tag filters
Given a feature "normal.feature" file: Given a feature "normal.feature" file:
""" """
Feature: tagged Feature: tagged
@x @x
Scenario: one Scenario: one
Given a feature path "one" Given a feature path "one"
@x @x
Scenario: two Scenario: two
Given a feature path "two" Given a feature path "two"
@x @y @x @y
Scenario: three Scenario: three
Given a feature path "three" Given a feature path "three"
@y @z @y @z
Scenario: four Scenario: four
Given a feature path "four" Given a feature path "four"
@ -130,17 +130,17 @@ Feature: tag filters
Given a feature "normal.feature" file: Given a feature "normal.feature" file:
""" """
Feature: f-tagged Feature: f-tagged
Scenario: one Scenario: one
Given a feature path "one" Given a feature path "one"
Scenario: two Scenario: two
Given a feature path "two" Given a feature path "two"
@f @f
Scenario: three Scenario: three
Given a feature path "three" Given a feature path "three"
@f @f
Scenario: four Scenario: four
Given a feature path "four" Given a feature path "four"
@ -158,17 +158,17 @@ Feature: tag filters
Given a feature "normal.feature" file: Given a feature "normal.feature" file:
""" """
Feature: f-tagged Feature: f-tagged
Scenario: one Scenario: one
Given a feature path "one" Given a feature path "one"
Scenario: two Scenario: two
Given a feature path "two" Given a feature path "two"
@f @f
Scenario: three Scenario: three
Given a feature path "three" Given a feature path "three"
@f @f
Scenario: four Scenario: four
Given a feature path "four" Given a feature path "four"
@ -176,16 +176,16 @@ Feature: tag filters
And a feature "another.feature" file: And a feature "another.feature" file:
""" """
Feature: non-tagged Feature: non-tagged
Scenario: five Scenario: five
Given a feature path "five" Given a feature path "five"
Scenario: six Scenario: six
Given a feature path "six" Given a feature path "six"
Scenario: seven Scenario: seven
Given a feature path "seven" Given a feature path "seven"
Scenario: eight Scenario: eight
Given a feature path "eight" Given a feature path "eight"
""" """
@ -197,3 +197,31 @@ Feature: tag filters
a feature path "three" a feature path "three"
a feature path "four" 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"
"""

Просмотреть файл

@ -15,7 +15,7 @@ func ApplyTagFilter(filter string, pickles []*messages.Pickle) []*messages.Pickl
return ff return ff
} }
return pickles return filterOutX(pickles)
} }
var result = []*messages.Pickle{} var result = []*messages.Pickle{}
@ -77,3 +77,14 @@ func filterF(pickles []*messages.Pickle) []*messages.Pickle {
return result 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
}