mirror of
https://github.com/clap-rs/clap
synced 2025-03-04 23:37:32 +00:00
Add regression test for issue 2279
This commit is contained in:
parent
42a4087220
commit
d5e3c6b0b9
1 changed files with 17 additions and 0 deletions
|
@ -519,3 +519,20 @@ fn issue_2022_get_flags_misuse() {
|
|||
let matches = app.get_matches_from(&[""]);
|
||||
assert!(matches.value_of("a").is_some())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn issue_2279() {
|
||||
let before_help_heading = App::new("app")
|
||||
.arg(Arg::new("foo").short('f').default_value("bar"))
|
||||
.help_heading("This causes default_value to be ignored")
|
||||
.get_matches_from(&[""]);
|
||||
|
||||
assert_eq!(before_help_heading.value_of("foo"), Some("bar"));
|
||||
|
||||
let after_help_heading = App::new("app")
|
||||
.help_heading("This causes default_value to be ignored")
|
||||
.arg(Arg::new("foo").short('f').default_value("bar"))
|
||||
.get_matches_from(&[""]);
|
||||
|
||||
assert_eq!(after_help_heading.value_of("foo"), Some("bar"));
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue