Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes to parser to pass all fixture/good tests #32

Merged
merged 7 commits into from
Mar 28, 2022
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,13 @@ All user visible changes to `gherkin` crate will be documented in this file. Thi
### Added

- Support text after `Background` and `Examples` keywords. ([#31])
- Add `description` field to the `Background`, `Examples`, `Rule` and `Scenario`. ([#32], [#10])
- Make `name` field of the `Background` required. ([#32])
- Make `table` field of the `Examples` optional. ([#32])

[#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