aboutsummaryrefslogtreecommitdiffstats
path: root/tests/cli.rs
blob: e09473dbd562b0abaa488b9eb8b9cee7e5290c45 (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
27
28
29
mod fixtures;

use assert_cmd::prelude::*;
use fixtures::Error;
use std::process::Command;
use structopt::clap::{crate_name, crate_version};

#[test]
/// Show help and exit.
fn help_shows() -> Result<(), Error> {
    Command::cargo_bin("miniserve")?
        .arg("-h")
        .assert()
        .success();

    Ok(())
}

#[test]
/// Show version and exit.
fn version_shows() -> Result<(), Error> {
    Command::cargo_bin("miniserve")?
        .arg("-V")
        .assert()
        .success()
        .stdout(format!("{} {}\n", crate_name!(), crate_version!()));

    Ok(())
}