tests: adds tests for passing assertions with new Arg::last setting

This commit is contained in:
Kevin K 2017-03-12 12:45:59 -04:00
parent 9a3bc98e9b
commit b049cecccc
No known key found for this signature in database
GPG key ID: 17218E4B3692F01A

View file

@ -233,4 +233,14 @@ fn last_positional_no_double_dash() {
.get_matches_from_safe(vec!["test", "tgt", "crp", "arg"]);
assert!(r.is_err());
assert_eq!(r.unwrap_err().kind, ErrorKind::UnknownArgument);
}
#[test]
fn last_positional_second_to_last_mult() {
let r = App::new("test")
.arg_from_usage("<TARGET> 'some target'")
.arg_from_usage("[CORPUS]... 'some corpus'")
.arg(Arg::from_usage("[ARGS]... 'some file'").last(true))
.get_matches_from_safe(vec!["test", "tgt", "crp1", "crp2", "--", "arg"]);
assert!(r.is_ok(), "{:?}", r.unwrap_err().kind);
}