Skip to content

Commit 4a9c3e6

Browse files
committed
test: add help integration test
1 parent cd43ac0 commit 4a9c3e6

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

tests/cli_integration_tests.rs

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use assert_cmd::Command;
2-
use predicates::str::is_match;
2+
use predicates::str::{is_empty, is_match, starts_with};
33

44
#[test]
55
fn test_version_subcommand() {
@@ -12,5 +12,22 @@ fn test_version_subcommand() {
1212
// Assert
1313
assertion
1414
.success()
15-
.stdout(is_match("^cotp \\d+\\.\\d+\\.\\d+-DEBUG-.+").unwrap());
15+
.stdout(is_match("^cotp \\d+\\.\\d+\\.\\d+-DEBUG-.+").unwrap())
16+
.stderr(is_empty());
17+
}
18+
19+
#[test]
20+
fn test_help_subcommand() {
21+
// Arrange / Act
22+
let assertion = Command::cargo_bin("cotp").unwrap().arg("--help").assert();
23+
24+
// Assert
25+
assertion
26+
.success()
27+
.stdout(starts_with(
28+
"Trustworthy, encrypted, command-line TOTP/HOTP authenticator app with import functionality.
29+
30+
Usage: cotp [OPTIONS] [COMMAND]",
31+
))
32+
.stderr(is_empty());
1633
}

0 commit comments

Comments
 (0)