mirror of
https://github.com/clap-rs/clap
synced 2024-12-14 06:42:33 +00:00
parent
2537894c4b
commit
3e838d1b77
1 changed files with 0 additions and 36 deletions
|
@ -130,19 +130,6 @@ SUBCOMMANDS:
|
|||
|
||||
";
|
||||
|
||||
static PARTIAL_MUT_ARGS: &str = "myprog 3.0
|
||||
|
||||
USAGE:
|
||||
myprog [OPTIONS]
|
||||
|
||||
OPTIONS:
|
||||
--first first about
|
||||
-h, --help Print help information
|
||||
--second [env: ENV_REPLACED=]
|
||||
--third third arg
|
||||
-V, --version Print version information
|
||||
";
|
||||
|
||||
#[test]
|
||||
fn setting() {
|
||||
let m = App::new("setting").setting(AppSettings::AllArgsOverrideSelf);
|
||||
|
@ -1249,26 +1236,3 @@ fn no_auto_version_mut_args() {
|
|||
assert!(result.is_ok());
|
||||
assert!(result.unwrap().is_present("version"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn partial_mut_args() {
|
||||
let app = App::new("myprog")
|
||||
.version("3.0")
|
||||
.arg(
|
||||
Arg::new("first").long("first").about("first arg"), // this about will be replaced
|
||||
)
|
||||
.arg(Arg::new("second").long("second").env("ENV_SECOND")) // this env will be replaced
|
||||
.arg(Arg::new("third").long("third").about("third arg")) // this will not be mutated
|
||||
.mut_args(|v| match v.get_name() {
|
||||
"first" => Some(v.about("first about")),
|
||||
"second" => Some(v.env("ENV_REPLACED")),
|
||||
_ => None,
|
||||
});
|
||||
|
||||
assert!(utils::compare_output(
|
||||
app,
|
||||
"myprog -h",
|
||||
PARTIAL_MUT_ARGS,
|
||||
false
|
||||
));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue