Skip to content

Commit

Permalink
test: Verify CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
Ed Page committed May 29, 2021
1 parent bb4b3da commit 9a04e50
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/cli.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
use assert_cmd::Command;

#[test]
fn test_stdin_success() {
let mut cmd = Command::cargo_bin("typos").unwrap();
cmd.arg("-").write_stdin("Hello world");
cmd.assert().success();
}

#[test]
fn test_stdin_failure() {
let mut cmd = Command::cargo_bin("typos").unwrap();
cmd.arg("-").write_stdin("Apropriate world");
cmd.assert().code(2);
}

#[test]
fn test_stdin_correct() {
let mut cmd = Command::cargo_bin("typos").unwrap();
cmd.arg("-")
.arg("--write-changes")
.write_stdin("Apropriate world");
cmd.assert().success().stdout("Appropriate world");
}

0 comments on commit 9a04e50

Please sign in to comment.