pub trait IntoCodePredicate<P>
where P: Predicate<i32>,
{ type Predicate; // Required method 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);

Required Associated Types§

source

type Predicate

The type of the predicate being returned.

Required Methods§

source

fn into_code(self) -> P

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

Implementations on Foreign Types§

source§

impl IntoCodePredicate<EqCodePredicate> for i32

source§

impl IntoCodePredicate<InCodePredicate> for &'static [i32]

source§

impl IntoCodePredicate<InCodePredicate> for Vec<i32>

Implementors§

source§

impl<P> IntoCodePredicate<P> for P
where P: Predicate<i32>,

§

type Predicate = P