mirror of
https://github.com/clap-rs/clap
synced 2024-12-13 22:32:33 +00:00
Add tests for 2229
This commit is contained in:
parent
28b58af63b
commit
3873b647d1
1 changed files with 16 additions and 0 deletions
|
@ -1192,3 +1192,19 @@ fn issue_1480_max_values_consumes_extra_arg_3() {
|
|||
assert!(res.is_err());
|
||||
assert_eq!(res.unwrap_err().kind, ErrorKind::UnknownArgument);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn issue_2229() {
|
||||
let m = App::new("multiple_values")
|
||||
.arg(
|
||||
Arg::new("pos")
|
||||
.about("multiple positionals")
|
||||
.number_of_values(3),
|
||||
)
|
||||
.try_get_matches_from(vec![
|
||||
"myprog", "val1", "val2", "val3", "val4", "val5", "val6",
|
||||
]);
|
||||
|
||||
assert!(m.is_err()); // This panics, because `m.is_err() == false`.
|
||||
assert_eq!(m.unwrap_err().kind, ErrorKind::WrongNumberOfValues);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue