Struct assert_cmd::assert::Assert[][src]

pub struct Assert { /* fields omitted */ }

Assert the state of an Output.

Create an Assert through the OutputAssertExt trait.

Examples

use assert_cmd::prelude::*;

use std::process::Command;

Command::main_binary()
    .unwrap()
    .assert()
    .success();

Methods

impl Assert
[src]

Create an Assert for a given Output.

Add the command line for additional context.

Add the stdn for additional context.

Access the contained std::process::Output.

Ensure the command succeeded.

Examples

use assert_cmd::prelude::*;

use std::process::Command;

Command::main_binary()
    .unwrap()
    .assert()
    .success();

Ensure the command failed.

Examples

use assert_cmd::prelude::*;

use std::process::Command;

Command::main_binary()
    .unwrap()
    .env("exit", "1")
    .assert()
    .failure();

Ensure the command aborted before returning a code.

Ensure the command returned the expected code.

Examples

use assert_cmd::prelude::*;

use std::process::Command;

Command::main_binary()
    .unwrap()
    .env("exit", "42")
    .assert()
    .code(42);

Ensure the command wrote the expected data to stdout.

Examples

use assert_cmd::prelude::*;

use std::process::Command;

Command::main_binary()
    .unwrap()
    .env("stdout", "hello")
    .env("stderr", "world")
    .assert()
    .stdout("hello\n");

Ensure the command wrote the expected data to stderr.

Examples

use assert_cmd::prelude::*;

use std::process::Command;

Command::main_binary()
    .unwrap()
    .env("stdout", "hello")
    .env("stderr", "world")
    .assert()
    .stderr("world\n");

Trait Implementations

impl Debug for Assert
[src]

Formats the value using the given formatter. Read more

impl Display for Assert
[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl Send for Assert

impl Sync for Assert