Skip to content

Commit

Permalink
fixup! amend tests since missing or external subcommand support was a…
Browse files Browse the repository at this point in the history
…dded
  • Loading branch information
fishface60 committed Oct 10, 2021
1 parent 59625f3 commit 699b26e
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions tests/subcommands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -531,12 +531,9 @@ fn busybox_like_multicall() {
assert_eq!(m.subcommand_name(), None);
assert_eq!(m.occurrences_of("install"), 1);

let m = app.clone().get_matches_from(&["a.out", "--install"]);
assert_eq!(m.subcommand_name(), None);
assert_eq!(m.occurrences_of("install"), 1);

let m = app.clone().get_matches_from(&["a.out", "true"]);
assert_eq!(m.subcommand_name(), Some("true"));
let m = app.clone().try_get_matches_from(&["a.out"]);
assert!(m.is_err());
assert_eq!(m.unwrap_err().kind, ErrorKind::UnknownArgument);

let m = app.try_get_matches_from(&["true", "--install"]);
assert!(m.is_err());
Expand All @@ -556,11 +553,9 @@ fn hostname_like_multicall() {
let m = app.clone().get_matches_from(&["dnsdomainname"]);
assert_eq!(m.subcommand_name(), Some("dnsdomainname"));

let m = app.clone().get_matches_from(&["a.out", "hostname"]);
assert_eq!(m.subcommand_name(), Some("hostname"));

let m = app.clone().get_matches_from(&["a.out", "dnsdomainname"]);
assert_eq!(m.subcommand_name(), Some("dnsdomainname"));
let m = app.clone().try_get_matches_from(&["a.out"]);
assert!(m.is_err());
assert_eq!(m.unwrap_err().kind, ErrorKind::UnknownArgument);

let m = app.try_get_matches_from_mut(&["hostname", "hostname"]);
assert!(m.is_err());
Expand Down

0 comments on commit 699b26e

Please sign in to comment.