mirror of
https://github.com/clap-rs/clap
synced 2024-11-10 14:54:15 +00:00
tests(Benches): fixes failing bench marks
This commit is contained in:
parent
4192e1acea
commit
60a61ddde6
2 changed files with 45 additions and 6 deletions
39
Cargo.toml
39
Cargo.toml
|
@ -28,3 +28,42 @@ lints = ["clippy", "nightly"]
|
|||
nightly = [] # for building with nightly and unstable features
|
||||
unstable = ["lints", "nightly"] # for building with travis-cargo
|
||||
debug = [] # for building with debug messages
|
||||
|
||||
[profile.release]
|
||||
opt-level = 3
|
||||
debug = false
|
||||
rpath = false
|
||||
lto = true
|
||||
debug-assertions = false
|
||||
# codegen-units ignored with lto=true
|
||||
|
||||
[profile.dev]
|
||||
opt-level = 0
|
||||
debug = true
|
||||
rpath = false
|
||||
lto = false
|
||||
debug-assertions = true
|
||||
codegen-units = 4
|
||||
|
||||
[profile.test]
|
||||
opt-level = 1
|
||||
debug = true
|
||||
rpath = false
|
||||
lto = false
|
||||
debug-assertions = true
|
||||
codegen-units = 2
|
||||
|
||||
[profile.bench]
|
||||
opt-level = 3
|
||||
debug = false
|
||||
rpath = false
|
||||
lto = true
|
||||
debug-assertions = false
|
||||
|
||||
[profile.doc]
|
||||
opt-level = 0
|
||||
debug = true
|
||||
rpath = false
|
||||
lto = false
|
||||
debug-assertions = true
|
||||
codegen-units = 4
|
||||
|
|
|
@ -8,7 +8,6 @@ use clap::{App, Arg, SubCommand};
|
|||
|
||||
use test::Bencher;
|
||||
|
||||
static M_VAL_NAMES: [&'static str; 2] = ["one", "two"];
|
||||
static ARGS: &'static str = "-o --option=[opt]... 'tests options'
|
||||
[positional] 'tests positionals'";
|
||||
static OPT3_VALS: [&'static str; 2] = ["fast", "slow"];
|
||||
|
@ -29,8 +28,8 @@ macro_rules! create_app {
|
|||
Arg::from_usage("[positional2] 'tests positionals with exclusions'"),
|
||||
Arg::from_usage("-O --Option [option3] 'tests options with specific value sets'").possible_values(&OPT3_VALS),
|
||||
Arg::from_usage("[positional3]... 'tests positionals with specific values'").possible_values(&POS3_VALS),
|
||||
Arg::from_usage("--multvals [multvals] 'Tests mutliple values, not mult occs'").value_names(&M_VAL_NAMES),
|
||||
Arg::from_usage("--multvalsmo [multvalsmo]... 'Tests mutliple values, not mult occs'").value_names(&M_VAL_NAMES),
|
||||
Arg::from_usage("--multvals [one] [two] 'Tests mutliple values, not mult occs'"),
|
||||
Arg::from_usage("--multvalsmo... [one] [two] 'Tests mutliple values, not mult occs'"),
|
||||
Arg::from_usage("--minvals2 [minvals]... 'Tests 2 min vals'").min_values(2),
|
||||
Arg::from_usage("--maxvals3 [maxvals]... 'Tests 3 max vals'").max_values(3)
|
||||
])
|
||||
|
@ -100,13 +99,13 @@ fn create_app_builder(b: &mut Bencher) {
|
|||
.long("multvals")
|
||||
.takes_value(true)
|
||||
.help("Tests mutliple values, not mult occs")
|
||||
.value_names(&M_VAL_NAMES))
|
||||
.value_names(&["one", "two"]))
|
||||
.arg(Arg::with_name("multvalsmo")
|
||||
.long("multvalsmo")
|
||||
.takes_value(true)
|
||||
.multiple(true)
|
||||
.help("Tests mutliple values, not mult occs")
|
||||
.value_names(&M_VAL_NAMES))
|
||||
.value_names(&["one", "two"]))
|
||||
.arg(Arg::with_name("minvals")
|
||||
.long("minvals2")
|
||||
.multiple(true)
|
||||
|
@ -135,7 +134,8 @@ fn create_app_builder(b: &mut Bencher) {
|
|||
});
|
||||
}
|
||||
|
||||
#[bench]
|
||||
#[cfg(feature = "unstable")]
|
||||
#[cfg_attr(feature = "unstable", bench)]
|
||||
fn create_app_macros(b: &mut Bencher) {
|
||||
b.iter(|| {
|
||||
clap_app!(claptests =>
|
||||
|
|
Loading…
Reference in a new issue