mirror of
https://github.com/clap-rs/clap
synced 2024-11-10 23:04:23 +00:00
tests(Subcommand Aliases): adds tests for new aliases
This commit is contained in:
parent
66b4dea65c
commit
fd8e211895
1 changed files with 18 additions and 0 deletions
|
@ -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",
|
||||
|
|
Loading…
Reference in a new issue