diff options
author | Robin Krahl <robin.krahl@ireas.org> | 2019-02-17 13:34:02 +0000 |
---|---|---|
committer | Daniel Mueller <deso@posteo.net> | 2019-02-17 19:50:52 -0800 |
commit | 4625be03bbebe74f5efa93a37f287e7911fbbbb4 (patch) | |
tree | 2803bd47589034709a04893ea3d27e70538973d5 /nitrocli/src/tests/run.rs | |
parent | d3fea96b4467cc6fa22c9e7dfe6b6ce6375848b0 (diff) | |
download | nitrocli-4625be03bbebe74f5efa93a37f287e7911fbbbb4.tar.gz nitrocli-4625be03bbebe74f5efa93a37f287e7911fbbbb4.tar.bz2 |
Add test case for --version option
This change adds a test case for the -V/--version option to the suite of
tests.
Diffstat (limited to 'nitrocli/src/tests/run.rs')
-rw-r--r-- | nitrocli/src/tests/run.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/nitrocli/src/tests/run.rs b/nitrocli/src/tests/run.rs index 260a851..dda7473 100644 --- a/nitrocli/src/tests/run.rs +++ b/nitrocli/src/tests/run.rs @@ -45,3 +45,22 @@ fn help_option() { test("--help"); test("-h") } + +#[test] +fn version_option() { + fn test(re: ®ex::Regex, opt: &'static str) { + let (rc, out, err) = Nitrocli::new().run(&[opt]); + + assert_eq!(rc, 0); + assert_eq!(err, b""); + + let s = String::from_utf8_lossy(&out).into_owned(); + let _ = re; + assert!(re.is_match(&s), out); + } + + let re = regex::Regex::new(r"^nitrocli \d+.\d+.\d+(-[^-]+)*\n$").unwrap(); + + test(&re, "--version"); + test(&re, "-V"); +} |