Skip to content

Commit

Permalink
Modify
Browse files Browse the repository at this point in the history
  • Loading branch information
casey committed Oct 9, 2024
1 parent c5ea43e commit dcc54d0
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/io_result_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,22 @@ impl<T> IoResultExt<T> for io::Result<T> {
}
}
}

#[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,
);
}
}

0 comments on commit dcc54d0

Please sign in to comment.