mirror of
https://github.com/clap-rs/clap
synced 2024-11-13 08:07:11 +00:00
tests(AllowLeadingHyphen): adds test issue 588 AllowLeadingHyphen not recognizing valid args
This commit is contained in:
parent
1ea9bef20d
commit
5c29448d54
1 changed files with 14 additions and 0 deletions
|
@ -263,6 +263,20 @@ fn delim_values_trailingvararg_with_delim() {
|
|||
assert_eq!(m.values_of("opt").unwrap().collect::<Vec<_>>(), &["test", "--foo", "-Wl", "-bar"]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn leading_hyphen() {
|
||||
let res = App::new("leadhy")
|
||||
.setting(AppSettings::AllowLeadingHyphen)
|
||||
.arg(Arg::with_name("some"))
|
||||
.arg(Arg::with_name("other")
|
||||
.short("o"))
|
||||
.get_matches_from_safe(vec!["", "-bar", "-o"]);
|
||||
assert!(res.is_ok(), "Error: {:?}", res.unwrap_err().kind);
|
||||
let m = res.unwrap();
|
||||
assert!(m.is_present("some"));
|
||||
assert!(m.is_present("other"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn leading_double_hyphen_trailingvararg() {
|
||||
let m = App::new("positional")
|
||||
|
|
Loading…
Reference in a new issue