mirror of
https://github.com/clap-rs/clap
synced 2025-03-04 23:37:32 +00:00
Add test for escaped values in help messages
This commit is contained in:
parent
0f42344685
commit
74cfcb4412
1 changed files with 30 additions and 0 deletions
|
@ -472,6 +472,19 @@ FLAGS:
|
|||
OPTIONS:
|
||||
--arg <argument> Pass an argument to the program. [default: default-argument]";
|
||||
|
||||
static ESCAPED_DEFAULT_VAL: &str = "default 0.1
|
||||
|
||||
USAGE:
|
||||
default [OPTIONS]
|
||||
|
||||
FLAGS:
|
||||
-h, --help Prints help information
|
||||
-V, --version Prints version information
|
||||
|
||||
OPTIONS:
|
||||
--arg <argument> Pass an argument to the program. [default: \"\\n\"] [possible values: normal, \" \", \"\\n\", \"\\t\",
|
||||
other]";
|
||||
|
||||
static LAST_ARG_USAGE: &str = "flamegraph 0.1
|
||||
|
||||
USAGE:
|
||||
|
@ -1376,6 +1389,23 @@ fn hidden_default_val() {
|
|||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn escaped_whitespace_values() {
|
||||
let app1 = App::new("default").version("0.1").term_width(120).arg(
|
||||
Arg::new("argument")
|
||||
.about("Pass an argument to the program.")
|
||||
.long("arg")
|
||||
.default_value("\n")
|
||||
.possible_values(&["normal", " ", "\n", "\t", "other"]),
|
||||
);
|
||||
assert!(utils::compare_output(
|
||||
app1,
|
||||
"default --help",
|
||||
ESCAPED_DEFAULT_VAL,
|
||||
false
|
||||
));
|
||||
}
|
||||
|
||||
fn issue_1112_setup() -> App<'static> {
|
||||
App::new("test")
|
||||
.author("Kevin K.")
|
||||
|
|
Loading…
Add table
Reference in a new issue