diff options
-rw-r--r-- | nitrocli/src/tests/run.rs | 12 | ||||
-rw-r--r-- | nitrocli/src/tests/status.rs | 2 |
2 files changed, 13 insertions, 1 deletions
diff --git a/nitrocli/src/tests/run.rs b/nitrocli/src/tests/run.rs index 260a851..1197915 100644 --- a/nitrocli/src/tests/run.rs +++ b/nitrocli/src/tests/run.rs @@ -45,3 +45,15 @@ fn help_option() { test("--help"); test("-h") } + +#[test] +fn version() { + let re = regex::Regex::new(r#"^nitrocli \d+\.\d+\.\d+\n$"#).unwrap(); + let (rc, out, err) = Nitrocli::new().run(&["--version"]); + + assert_eq!(rc, 0); + assert_eq!(err, b""); + + let out = String::from_utf8_lossy(&out).into_owned(); + assert!(re.is_match(&out), out); +} diff --git a/nitrocli/src/tests/status.rs b/nitrocli/src/tests/status.rs index acd33dc..83ce61f 100644 --- a/nitrocli/src/tests/status.rs +++ b/nitrocli/src/tests/status.rs @@ -42,7 +42,7 @@ fn output(device: nitrokey::DeviceWrapper) -> crate::Result<()> { r#"^Status: model: (Pro|Storage) serial number: 0x[[:xdigit:]]{8} - firmware version: \d+.\d+ + firmware version: \d+\.\d+ user retry count: [0-3] admin retry count: [0-3] $"#, |