Skip to content

Commit

Permalink
tests(App): adds print_help test
Browse files Browse the repository at this point in the history
  • Loading branch information
kbknapp committed Sep 9, 2015
1 parent c92a98f commit f9c04ae
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/app/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3491,3 +3491,33 @@ impl<'a, 'v, 'ab, 'u, 'h, 'ar> App<'a, 'v, 'ab, 'u, 'h, 'ar>{
}

}

#[cfg(test)]
mod test {
use super::App;

#[test]
fn print_app_help() {
let app = App::new("test")
.author("Kevin K.")
.about("tests stuff")
.args_from_usage("-f, --flag 'some flag'
--option [opt] 'some option'");
let mut help = vec![];
app.print_help(&mut help).ok().expect("failed to print help");
assert_eq!(String::from_utf8_lossy(help), String::from("test
Kevin K.
tests stuff
USAGE:
fake [FLAGS] [OPTIONS] [SUBCOMMAND]
FLAGS:
-f, --flag some flag
-h, --help Prints help information
-V, --version Prints version information
OPTIONS:
--option <opt> some option"));
}
}

0 comments on commit f9c04ae

Please sign in to comment.