mirror of
https://github.com/clap-rs/clap
synced 2024-12-14 14:52:33 +00:00
Add regression test for issue 1794
This commit is contained in:
parent
573dc245e6
commit
d7e2fd6294
1 changed files with 35 additions and 0 deletions
|
@ -2360,3 +2360,38 @@ fn option_usage_order() {
|
|||
false
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn issue_1794_usage() {
|
||||
static USAGE_WITH_GROUP: &'static str = "hello
|
||||
|
||||
USAGE:
|
||||
deno <pos1|--option1> [pos2]
|
||||
|
||||
ARGS:
|
||||
<pos1>
|
||||
<pos2>
|
||||
|
||||
FLAGS:
|
||||
-h, --help Prints help information
|
||||
--option1
|
||||
-V, --version Prints version information";
|
||||
|
||||
let app = clap::App::new("hello")
|
||||
.bin_name("deno")
|
||||
.arg(Arg::new("option1").long("option1").takes_value(false))
|
||||
.arg(Arg::new("pos1").takes_value(true))
|
||||
.group(
|
||||
ArgGroup::new("arg1")
|
||||
.args(&["pos1", "option1"])
|
||||
.required(true),
|
||||
)
|
||||
.arg(Arg::new("pos2").takes_value(true));
|
||||
|
||||
assert!(utils::compare_output(
|
||||
app,
|
||||
"deno --help",
|
||||
USAGE_WITH_GROUP,
|
||||
false
|
||||
));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue