Skip to content

Commit

Permalink
tests(Subcommand Aliases): adds tests for new aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
kbknapp committed May 10, 2016
1 parent 66b4dea commit fd8e211
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/subcommands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,24 @@ fn subcommand_multiple() {
assert_eq!(sub_m.value_of("test").unwrap(), "testing");
}

#[test]
fn single_alias() {
let m = App::new("myprog")
.subcommand(SubCommand::with_name("test")
.alias("do-stuff"))
.get_matches_from(vec!["myprog", "do-stuff"]);
assert_eq!(m.subcommand_name(), Some("test"));
}

#[test]
fn multiple_aliases() {
let m = App::new("myprog")
.subcommand(SubCommand::with_name("test")
.aliases(&["do-stuff", "test-stuff"]))
.get_matches_from(vec!["myprog", "test-stuff"]);
assert_eq!(m.subcommand_name(), Some("test"));
}

#[test]
fn subcmd_did_you_mean_output() {
test::check_err_output(test::complex_app(), "clap-test subcm",
Expand Down

0 comments on commit fd8e211

Please sign in to comment.