mirror of
https://github.com/clap-rs/clap
synced 2025-03-04 23:37:32 +00:00
Merge #2082
2082: Do not capture args meant for libtest from the integration tests r=pksunkara a=mkantor Co-authored-by: Matt Kantor <the.matt.kantor@gmail.com>
This commit is contained in:
commit
be27f41f83
1 changed files with 12 additions and 8 deletions
|
@ -608,6 +608,10 @@ fn setup() -> App<'static> {
|
|||
.version("1.3")
|
||||
}
|
||||
|
||||
fn empty_args() -> impl IntoIterator<Item = String> {
|
||||
std::iter::empty()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn help_short() {
|
||||
let m = setup().try_get_matches_from(vec!["myprog", "-h"]);
|
||||
|
@ -1706,7 +1710,7 @@ fn help_required_but_not_given() {
|
|||
App::new("myapp")
|
||||
.setting(AppSettings::HelpRequired)
|
||||
.arg(Arg::new("foo"))
|
||||
.get_matches();
|
||||
.get_matches_from(empty_args());
|
||||
}
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
|
@ -1716,7 +1720,7 @@ fn help_required_but_not_given_settings_after_args() {
|
|||
App::new("myapp")
|
||||
.arg(Arg::new("foo"))
|
||||
.setting(AppSettings::HelpRequired)
|
||||
.get_matches();
|
||||
.get_matches_from(empty_args());
|
||||
}
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
|
@ -1727,7 +1731,7 @@ fn help_required_but_not_given_for_one_of_two_arguments() {
|
|||
.setting(AppSettings::HelpRequired)
|
||||
.arg(Arg::new("foo"))
|
||||
.arg(Arg::new("bar").about("It does bar stuff"))
|
||||
.get_matches();
|
||||
.get_matches_from(empty_args());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -1740,7 +1744,7 @@ fn help_required_locally_but_not_given_for_subcommand() {
|
|||
.arg(Arg::new("create").about("creates bar"))
|
||||
.arg(Arg::new("delete")),
|
||||
)
|
||||
.get_matches();
|
||||
.get_matches_from(empty_args());
|
||||
}
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
|
@ -1755,7 +1759,7 @@ fn help_required_globally_but_not_given_for_subcommand() {
|
|||
.arg(Arg::new("create").about("creates bar"))
|
||||
.arg(Arg::new("delete")),
|
||||
)
|
||||
.get_matches();
|
||||
.get_matches_from(empty_args());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -1768,7 +1772,7 @@ fn help_required_and_given_for_subcommand() {
|
|||
.arg(Arg::new("create").about("creates bar"))
|
||||
.arg(Arg::new("delete").about("deletes bar")),
|
||||
)
|
||||
.get_matches();
|
||||
.get_matches_from(empty_args());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -1776,14 +1780,14 @@ fn help_required_and_given() {
|
|||
App::new("myapp")
|
||||
.setting(AppSettings::HelpRequired)
|
||||
.arg(Arg::new("foo").about("It does foo stuff"))
|
||||
.get_matches();
|
||||
.get_matches_from(empty_args());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn help_required_and_no_args() {
|
||||
App::new("myapp")
|
||||
.setting(AppSettings::HelpRequired)
|
||||
.get_matches();
|
||||
.get_matches_from(empty_args());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Add table
Reference in a new issue