You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
417 B
20 lines
417 B
use structopt::StructOpt;
|
|
|
|
mod utils;
|
|
|
|
use utils::*;
|
|
|
|
#[test]
|
|
fn auto_default_value() {
|
|
#[derive(StructOpt, PartialEq, Debug)]
|
|
struct Opt {
|
|
#[structopt(default_value)]
|
|
arg: i32,
|
|
}
|
|
assert_eq!(Opt { arg: 0 }, Opt::from_iter(&["test"]));
|
|
assert_eq!(Opt { arg: 1 }, Opt::from_iter(&["test", "1"]));
|
|
|
|
let help = get_long_help::<Opt>();
|
|
assert!(help.contains("[default: 0]"));
|
|
}
|