Skip to content

Commit

Permalink
Add assert_cmd tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jbhannah committed Jun 16, 2022
1 parent 92f6743 commit 6b359fa
Show file tree
Hide file tree
Showing 3 changed files with 121 additions and 0 deletions.
107 changes: 107 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ homepage = "https://github.com/jbhannah/pkpw"

[dependencies]
arboard = "2.1.1"
assert_cmd = "2.0.4"
clap = { version = "3.2.5", features = ["derive"] }
lazy_static = "1.4.0"
rand = "0.8.5"
Expand Down
13 changes: 13 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,19 @@ mod test {

use super::*;

#[test]
fn test_command() {
let mut cmd = assert_cmd::Command::cargo_bin(env!("CARGO_PKG_NAME")).unwrap();
cmd.assert().success();
}

#[test]
fn test_command_length_excl_pick() {
let mut cmd = assert_cmd::Command::cargo_bin(env!("CARGO_PKG_NAME")).unwrap();
cmd.arg("-l 40").arg("-n 4");
cmd.assert().failure();
}

/// Ensure that length(…, 40) returns a vector of five strings which create
/// a password with a length greater than 40.
#[test]
Expand Down

0 comments on commit 6b359fa

Please sign in to comment.