-
Notifications
You must be signed in to change notification settings - Fork 71
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
Custom Parameters in Cucumber Expressions (#124) #168
Conversation
FCM
|
Cargo.toml
Outdated
@@ -40,7 +40,7 @@ timestamps = [] | |||
async-trait = "0.1.40" | |||
atty = "0.2.14" | |||
console = "0.15" | |||
derive_more = { version = "0.99.16", features = ["as_ref", "deref", "deref_mut", "display", "error", "from", "into"], default_features = false } | |||
derive_more = { version = "0.99.16", features = ["as_ref", "deref", "deref_mut", "display", "error", "from", "from_str", "into"], default_features = false } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we don't use derive(FromStr)
in src/
, we shouldn't introduce it here, but rather in [dev-dependencies]
.
@@ -54,6 +54,7 @@ structopt = "0.3.25" | |||
|
|||
# "macros" feature dependencies | |||
cucumber-codegen = { version = "0.11.0-dev", path = "./codegen", optional = true } | |||
cucumber-expressions = { version = "0.1.0", features = ["into-regex"], optional = true } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, we don't need "into-regex"
feature in cucumber
crate directly, so we shouldn't require it.
codegen/src/parameter.rs
Outdated
name: Option<syn::LitStr>, | ||
} | ||
|
||
/// Representation of a struct implementing `Parameter`, used for code |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why only struct
? Any type satisfying the requirements will be valid here.
codegen/src/attribute.rs
Outdated
Provider, | ||
) | ||
.unwrap_or_else(|e| { | ||
panic!("Cucumber expression failed: {}", e) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As it should never fail, then we may use just unwrap(), as we do with regular expressions.
Part of #124
Synopsis
For now there is only support for default parameters in cucumber expressions.
Solution
Implement
Parameter
derive macro and add const asserts to avoid runtime panics.Checklist
Draft:
prefixDraft:
prefix is removed