mirror of
https://github.com/clap-rs/clap
synced 2024-12-13 22:32:33 +00:00
tests: adds tests for PosBuilder Display
This commit is contained in:
parent
3a5bb17596
commit
32044f26e0
1 changed files with 47 additions and 0 deletions
|
@ -47,3 +47,50 @@ impl<'n> Display for PosBuilder<'n> {
|
|||
Ok(())
|
||||
}
|
||||
}
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::PosBuilder;
|
||||
|
||||
#[test]
|
||||
fn posbuilder_display() {
|
||||
let p = PosBuilder {
|
||||
name: "pos",
|
||||
help: None,
|
||||
multiple: true,
|
||||
blacklist: None,
|
||||
required: false,
|
||||
possible_vals: None,
|
||||
requires: None,
|
||||
num_vals: None,
|
||||
min_vals: None,
|
||||
max_vals: None,
|
||||
index: 1,
|
||||
empty_vals: true,
|
||||
global: false,
|
||||
validator: None,
|
||||
overrides: None
|
||||
};
|
||||
|
||||
assert_eq!(&*format!("{}", p), "[pos]...");
|
||||
|
||||
let p2 = PosBuilder {
|
||||
name: "pos",
|
||||
help: None,
|
||||
multiple: false,
|
||||
blacklist: None,
|
||||
required: true,
|
||||
possible_vals: None,
|
||||
requires: None,
|
||||
num_vals: None,
|
||||
min_vals: None,
|
||||
max_vals: None,
|
||||
index: 1,
|
||||
empty_vals: true,
|
||||
global: false,
|
||||
validator: None,
|
||||
overrides: None
|
||||
};
|
||||
|
||||
assert_eq!(&*format!("{}", p2), "<pos>");
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue