Trait assert_cmd::assert::IntoOutputPredicate
source · pub trait IntoOutputPredicate<P>{
type Predicate;
// Required method
fn into_output(self) -> P;
}
Expand description
Used by Assert::stdout
and Assert::stderr
to convert Self
into the needed [predicates_core::Predicate<[u8]>
].
§Examples
use assert_cmd::prelude::*;
use std::process::Command;
use predicates::prelude::*;
Command::cargo_bin("bin_fixture")
.unwrap()
.env("stdout", "hello")
.env("stderr", "world")
.assert()
.stdout(predicate::str::diff("hello\n").from_utf8());
// which can be shortened to:
Command::cargo_bin("bin_fixture")
.unwrap()
.env("stdout", "hello")
.env("stderr", "world")
.assert()
.stdout("hello\n");
Required Associated Types§
Required Methods§
sourcefn into_output(self) -> P
fn into_output(self) -> P
Convert to a predicate for testing a path.