Skip to content

Commit

Permalink
Pass all fixture/good tests (#32)
Browse files Browse the repository at this point in the history
- add `description` field to `Background`, `Examples`, `Rule` and `Scenario` (#10)
- make `name` field of `Background` required
- make `table` field of `Examples` optional

Co-authored-by: ilslv <ilya.solovyiov@gmail.com>
  • Loading branch information
mladedav and ilslv authored Mar 28, 2022
1 parent 0add12f commit b19fa8d
Show file tree
Hide file tree
Showing 107 changed files with 1,672 additions and 1,179 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,19 @@ All user visible changes to `gherkin` crate will be documented in this file. Thi

[Diff](/../../compare/v0.11.2...v0.12.0)

### BC Breaks

- Made `name` field of `Background` required. ([#32])
- Make `table` field of `Examples` optional. ([#32])

### Added

- Support text after `Background` and `Examples` keywords. ([#31])
- `description` field to `Background`, `Examples`, `Rule` and `Scenario`. ([#32], [#10])

[#10]: /../../issues/10
[#31]: /../../pull/31
[#32]: /../../pull/32



Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ syn = "1.0"
async-trait = "0.1.40"
cucumber = "0.11"
futures = "0.3.5"
serde_json = "1.0.78"

[[test]]
name = "cucumber"
Expand Down
68 changes: 59 additions & 9 deletions src/keywords.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,22 +60,72 @@ impl<'a> Keywords<'a> {
v
}

pub fn exclude_in_description(&self) -> Vec<&'a str> {
let mut v = [
self.feature,
pub fn excluded_feature(&'a self) -> Vec<&'a str> {
[
self.background,
self.rule,
self.scenario,
self.scenario_outline,
self.examples,
]
.iter()
.flat_map(|s| s.iter().map(Deref::deref))
.collect::<Vec<_>>();
.concat()
}

v.sort_unstable();
pub fn excluded_rule(&'a self) -> Vec<&'a str> {
[self.background, self.scenario, self.scenario_outline].concat()
}

v
pub fn excluded_background(&'a self) -> Vec<&'a str> {
[
self.scenario,
self.scenario_outline,
self.given,
self.when,
self.then,
self.and,
self.but,
]
.concat()
}

pub fn excluded_scenario(&'a self) -> Vec<&'a str> {
[
self.scenario,
self.scenario_outline,
self.given,
self.when,
self.then,
self.and,
self.but,
]
.concat()
}

pub fn excluded_scenario_outline(&'a self) -> Vec<&'a str> {
[
self.scenario,
self.scenario_outline,
self.given,
self.when,
self.then,
self.and,
self.but,
]
.concat()
}

pub fn excluded_examples(&'a self) -> Vec<&'a str> {
let mut r = [
self.scenario,
self.scenario_outline,
self.given,
self.when,
self.then,
self.and,
self.but,
]
.concat();
r.push("|");
r
}
}

Expand Down
Loading

0 comments on commit b19fa8d

Please sign in to comment.