Skip to content

Commit 9a04e50

Browse files
author
Ed Page
committed
test: Verify CLI
1 parent bb4b3da commit 9a04e50

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

tests/cli.rs

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
use assert_cmd::Command;
2+
3+
#[test]
4+
fn test_stdin_success() {
5+
let mut cmd = Command::cargo_bin("typos").unwrap();
6+
cmd.arg("-").write_stdin("Hello world");
7+
cmd.assert().success();
8+
}
9+
10+
#[test]
11+
fn test_stdin_failure() {
12+
let mut cmd = Command::cargo_bin("typos").unwrap();
13+
cmd.arg("-").write_stdin("Apropriate world");
14+
cmd.assert().code(2);
15+
}
16+
17+
#[test]
18+
fn test_stdin_correct() {
19+
let mut cmd = Command::cargo_bin("typos").unwrap();
20+
cmd.arg("-")
21+
.arg("--write-changes")
22+
.write_stdin("Apropriate world");
23+
cmd.assert().success().stdout("Appropriate world");
24+
}

0 commit comments

Comments
 (0)