mirror of
https://github.com/crate-ci/typos.git
synced 2024-11-22 00:51:11 -05:00
test: Verify CLI
This commit is contained in:
parent
bb4b3dad88
commit
9a04e50a88
1 changed files with 24 additions and 0 deletions
24
tests/cli.rs
Normal file
24
tests/cli.rs
Normal file
|
@ -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");
|
||||
}
|
Loading…
Reference in a new issue