Crate assert_cmd[][src]

Assert process::Command - Easy command initialization and assertions.

[dependencies]
assert_cmd = "0.2"

Example

Here's a trivial example:

This example is not tested
extern crate assert_cmd;

use std::process::Command;
use assert_cmd::prelude::*;

fn main() {
    let mut cmd = Command::main_binary().unwrap();
    cmd.assert().success();
}

Relevant crates

Other crates that might be useful in testing command line programs.

  • duct for orchestrating multiple processes.
  • assert_fs for filesystem fixtures and assertions.
  • dir-diff for testing file side-effects.
  • tempfile for scratchpad directories.

Modules

prelude

Extension traits that are useful to have available.

Structs

Assert

process::Output assertions.

OutputError

std::process::Output as a Fail.

StdInCommand

std::process::Command with a stdin buffer.

Traits

CommandCargoExt

Extend Command with helpers for running the current crate's binaries.

CommandStdInExt

Extend Command with a helper to pass a buffer to stdin

IntoCodePredicate

Convert to a predicate for testing a program's exit code.

OutputAssertExt

Extend process::Output with assertions.

OutputOkExt

Extends std::process::Output with methods to convert it to an OutputResult.

Functions

cargo_bin_path

Get the path to the specified binary of the current crate.

cargo_example_path

Get the path to the specified example of the current crate.

main_binary_path

Get the path to the crate's main binary.

Type Definitions

OutputResult

std::process::Output represented as a Result.