mirror of
https://github.com/clap-rs/clap
synced 2024-12-13 22:32:33 +00:00
tests: adds tests for FlagBuilder Display
This commit is contained in:
parent
e27a3f3146
commit
3a5bb17596
1 changed files with 35 additions and 0 deletions
|
@ -38,3 +38,38 @@ impl<'n> Display for FlagBuilder<'n> {
|
|||
}
|
||||
}
|
||||
}
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::FlagBuilder;
|
||||
|
||||
#[test]
|
||||
fn flagbuilder_display() {
|
||||
let f = FlagBuilder {
|
||||
name: "flg",
|
||||
short: None,
|
||||
long: Some("flag"),
|
||||
help: None,
|
||||
multiple: true,
|
||||
blacklist: None,
|
||||
requires: None,
|
||||
global: false,
|
||||
overrides: None
|
||||
};
|
||||
|
||||
assert_eq!(&*format!("{}", f), "--flag");
|
||||
|
||||
let f2 = FlagBuilder {
|
||||
name: "flg",
|
||||
short: Some('f'),
|
||||
long: None,
|
||||
help: None,
|
||||
multiple: false,
|
||||
blacklist: None,
|
||||
requires: None,
|
||||
global: false,
|
||||
overrides: None
|
||||
};
|
||||
|
||||
assert_eq!(&*format!("{}", f2), "-f");
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue