assert_ok 1.0.2

A macro that asserts a Result is Ok
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use assert_ok::assert_ok;

#[test]
fn test_it_accepts_ok() {
    let _z: u32 = assert_ok!("42".parse());
}

#[test]
#[should_panic]
fn test_it_panics_on_err() {
    let _z: u32 = assert_ok!("nope".parse());
}

#[test]
#[should_panic(expected = "Error calling \"nope\".parse(): ParseIntError { kind: InvalidDigit }")]
fn test_it_panics_on_err_with_correct_message() {
    let _z: u32 = assert_ok!("nope".parse());
}