diff options
| author | Carlos Maiolino <[email protected]> | 2025-09-06 09:30:39 +0200 |
|---|---|---|
| committer | Carlos Maiolino <[email protected]> | 2025-09-06 09:35:00 +0200 |
| commit | ee8a08bfa24d9a3d09273fdebe8d73ac38c545f9 (patch) | |
| tree | 856c1a6347bea7f29bf2048c8f2028e5a3e656ef /rust/echor/tests/cli.rs~ | |
| parent | 93b1c04a218858ecc59b6b8929103695b7b8c2a0 (diff) | |
Update guessing game
Signed-off-by: Carlos Maiolino <[email protected]>
Diffstat (limited to 'rust/echor/tests/cli.rs~')
| -rw-r--r-- | rust/echor/tests/cli.rs~ | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/rust/echor/tests/cli.rs~ b/rust/echor/tests/cli.rs~ new file mode 100644 index 0000000..d6e32b1 --- /dev/null +++ b/rust/echor/tests/cli.rs~ @@ -0,0 +1,26 @@ +use assert_cmd::Command; +use predicates::prelude::*; + +#[test] +fn dies_no_args() { + let mut cmd = Command::cargo_bin("echor").unwrap(); + cmd.assert() + .failure() + .stderr(predicate::str::contains("USAGE")); +} + +#[test] +fn runs() { + let mut cmd = Command::cargo_bin("echor").unwrap(); + cmd.arg("Howdy partner").assert().success(); +} + +#[test] +fn hello1() { + let expected = fs::read_to_string("tests/expected/hello1.txt").unwrap(); + let mut cmd = Command::cargo_bin("echor").unwrap(); + cmd.arg("Hello there") + .assert() + .success() + .stdout(expected); +} |
