summaryrefslogtreecommitdiff
path: root/rust/echor/tests/cli.rs~
blob: d6e32b1939a81abcea30c7be57c1176af023cd3d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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);
}