mirror of
https://github.com/clap-rs/clap
synced 2024-12-14 23:02:31 +00:00
tests(subcommands): subcommand placeholder in help label
This commit is contained in:
parent
6d083f5653
commit
6eae5ed560
1 changed files with 8 additions and 4 deletions
|
@ -365,10 +365,14 @@ fn issue_1722_not_emit_error_when_arg_follows_similar_to_a_subcommand() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn subcommand_placeholder_test() {
|
fn subcommand_placeholder_test() {
|
||||||
let usage = App::new("myprog")
|
let mut app = App::new("myprog")
|
||||||
.subcommand(App::new("subcommand"))
|
.subcommand(App::new("subcommand"))
|
||||||
.subcommand_placeholder("TEST_PLACEHOLDER")
|
.subcommand_placeholder("TEST_PLACEHOLDER");
|
||||||
.generate_usage();
|
|
||||||
|
|
||||||
assert_eq!(&usage, "USAGE:\n myprog [TEST_PLACEHOLDER]");
|
assert_eq!(&app.generate_usage(), "USAGE:\n myprog [TEST_PLACEHOLDER]");
|
||||||
|
|
||||||
|
let mut help_text = Vec::new();
|
||||||
|
app.write_help(&mut help_text).expect("Failed to write to internal buffer");
|
||||||
|
|
||||||
|
assert!(String::from_utf8(help_text).unwrap().contains("TEST_PLACEHOLDERS:"));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue