diff --git a/src/io_result_ext.rs b/src/io_result_ext.rs index b0a59d2..810ab6a 100644 --- a/src/io_result_ext.rs +++ b/src/io_result_ext.rs @@ -18,3 +18,22 @@ impl IoResultExt for io::Result { } } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn into_option() { + Err::<(), io::Error>(io::Error::new(io::ErrorKind::InvalidInput, "foo")) + .into_option() + .unwrap_err(); + + assert_eq!( + Err::<(), io::Error>(io::Error::new(io::ErrorKind::NotFound, "foo")) + .into_option() + .unwrap(), + None, + ); + } +}