pub trait OutputOkExtwhere
    Self: Sized,
{ fn ok(self) -> OutputResult; fn unwrap(self) -> Output { ... } fn unwrap_err(self) -> OutputError { ... } }
Expand description

Converts a type to an OutputResult.

This is for example implemented on std::process::Output.

Examples

use assert_cmd::prelude::*;

use std::process::Command;

let result = Command::new("echo")
    .args(&["42"])
    .ok();
assert!(result.is_ok());

Required Methods§

Convert an Output to an OutputResult.

Examples
use assert_cmd::prelude::*;

use std::process::Command;

let result = Command::new("echo")
    .args(&["42"])
    .ok();
assert!(result.is_ok());

Provided Methods§

Unwrap a Output but with a prettier message than .ok().unwrap().

Examples
use assert_cmd::prelude::*;

use std::process::Command;

let output = Command::new("echo")
    .args(&["42"])
    .unwrap();

Unwrap a Output but with a prettier message than ok().err().unwrap().

Examples
use assert_cmd::prelude::*;

use std::process::Command;

let err = Command::main_binary()
    .unwrap()
    .env("exit", "42")
    .unwrap_err();

Implementations on Foreign Types§

Implementors§