From 32044f26e0cac7a87a932e908c7f56dcd6f16257 Mon Sep 17 00:00:00 2001 From: Kevin K Date: Fri, 4 Sep 2015 13:29:57 -0400 Subject: [PATCH] tests: adds tests for PosBuilder Display --- src/args/argbuilder/positional.rs | 47 +++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/src/args/argbuilder/positional.rs b/src/args/argbuilder/positional.rs index c348042b..634258f8 100644 --- a/src/args/argbuilder/positional.rs +++ b/src/args/argbuilder/positional.rs @@ -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), ""); + } +} \ No newline at end of file