tests(Subcommand Aliases): adds tests for new aliases

This commit is contained in:
Kevin K 2016-05-10 15:26:43 -04:00
parent 66b4dea65c
commit fd8e211895

View file

@ -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",