how.rs/src/test.rs

17 lines
374 B
Rust

use super::*;
#[test]
fn test_io_result_context() {
let r: Result<()> =
Err(std::io::Error::new(std::io::ErrorKind::Other, "foo error")).context("bar reason");
assert!(r.is_err());
}
#[test]
fn test_option_context() {
let r = Some(69).context("not nice");
assert!(r.is_ok());
let r = None::<i32>.context("not nice");
assert!(r.is_err());
}