Trait assert_cmd::assert::IntoCodePredicate
source ·
[−]pub trait IntoCodePredicate<P> where
P: Predicate<i32>, {
type Predicate;
fn into_code(self) -> P;
}
Expand description
Used by Assert::code
to convert Self
into the needed
predicates_core::Predicate<i32>
.
Examples
use assert_cmd::prelude::*;
use std::process::Command;
use predicates::prelude::*;
Command::cargo_bin("bin_fixture")
.unwrap()
.env("exit", "42")
.assert()
.code(predicate::eq(42));
// which can be shortened to:
Command::cargo_bin("bin_fixture")
.unwrap()
.env("exit", "42")
.assert()
.code(42);