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.
47 lines
1.0 KiB
47 lines
1.0 KiB
mod utils;
|
|
|
|
use structopt::StructOpt;
|
|
use utils::*;
|
|
|
|
#[test]
|
|
fn it_works() {
|
|
#[derive(Debug, PartialEq, StructOpt)]
|
|
#[structopt(rename_all_env = "kebab")]
|
|
struct BehaviorModel {
|
|
#[structopt(env)]
|
|
be_nice: String,
|
|
}
|
|
|
|
let help = get_help::<BehaviorModel>();
|
|
assert!(help.contains("[env: be-nice=]"));
|
|
}
|
|
|
|
#[test]
|
|
fn default_is_screaming() {
|
|
#[derive(Debug, PartialEq, StructOpt)]
|
|
struct BehaviorModel {
|
|
#[structopt(env)]
|
|
be_nice: String,
|
|
}
|
|
|
|
let help = get_help::<BehaviorModel>();
|
|
assert!(help.contains("[env: BE_NICE=]"));
|
|
}
|
|
|
|
#[test]
|
|
fn overridable() {
|
|
#[derive(Debug, PartialEq, StructOpt)]
|
|
#[structopt(rename_all_env = "kebab")]
|
|
struct BehaviorModel {
|
|
#[structopt(env)]
|
|
be_nice: String,
|
|
|
|
#[structopt(rename_all_env = "pascal", env)]
|
|
be_agressive: String,
|
|
}
|
|
|
|
let help = get_help::<BehaviorModel>();
|
|
assert!(help.contains("[env: be-nice=]"));
|
|
assert!(help.contains("[env: BeAgressive=]"));
|
|
}
|