Skip to content

Commit 9e3c05e

Browse files
committed
test(help): Show panic with short, valueless arg
1 parent c9898d0 commit 9e3c05e

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

tests/builder/help.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2439,6 +2439,30 @@ Baz:
24392439
utils::assert_output(cmd, "demo -h", expected, false);
24402440
}
24412441

2442+
#[test]
2443+
#[should_panic]
2444+
fn short_with_count() {
2445+
let cmd = Command::new("demo").arg(
2446+
Arg::new("baz")
2447+
.short('z')
2448+
.action(ArgAction::Count)
2449+
.help("Short only")
2450+
.help_heading("Baz"),
2451+
);
2452+
2453+
let expected = str![[r#"
2454+
Usage: demo [OPTIONS]
2455+
2456+
Options:
2457+
-h, --help Print help
2458+
2459+
Baz:
2460+
-z... Short only
2461+
2462+
"#]];
2463+
utils::assert_output(cmd, "demo -h", expected, false);
2464+
}
2465+
24422466
#[test]
24432467
fn issue_1487() {
24442468
let cmd = Command::new("test")

0 commit comments

Comments
 (0)