Skip to content

Commit 15509af

Browse files
committed
test: Demonstrate default value ui bug on no desc
1 parent e115243 commit 15509af

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

tests/builder/help.rs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3107,6 +3107,39 @@ fn too_many_value_names_panics() {
31073107
.debug_assert();
31083108
}
31093109

3110+
#[test]
3111+
fn help_enum_arg_with_no_description() {
3112+
let cmd = Command::new("test").arg(
3113+
Arg::new("config")
3114+
.action(ArgAction::Set)
3115+
// .help("No help description for this argument")
3116+
.short('c')
3117+
.long("config")
3118+
.value_name("MODE")
3119+
.value_parser([
3120+
PossibleValue::new("fast"),
3121+
PossibleValue::new("slow").help("slower than fast"),
3122+
PossibleValue::new("secret speed").hide(true),
3123+
])
3124+
.default_value("fast"),
3125+
);
3126+
3127+
let expected = str![[r#"
3128+
Usage: test [OPTIONS]
3129+
3130+
Options:
3131+
-c, --config <MODE>
3132+
Possible values:
3133+
- fast
3134+
- slow: slower than fast[default: fast]
3135+
3136+
-h, --help
3137+
Print help (see a summary with '-h')
3138+
3139+
"#]];
3140+
utils::assert_output(cmd, "test --help", expected, false);
3141+
}
3142+
31103143
#[test]
31113144
fn disabled_help_flag() {
31123145
let res = Command::new("foo")

0 commit comments

Comments
 (0)