Add test for io::Error::new_const.
This commit is contained in:
parent
2da9856f17
commit
96783625a0
@ -57,3 +57,13 @@ impl error::Error for TestError {}
|
||||
let extracted = err.into_inner().unwrap();
|
||||
extracted.downcast::<TestError>().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_const() {
|
||||
const E: Error = Error::new_const(ErrorKind::NotFound, &"hello");
|
||||
|
||||
assert_eq!(E.kind(), ErrorKind::NotFound);
|
||||
assert_eq!(E.to_string(), "hello");
|
||||
assert!(format!("{:?}", E).contains("\"hello\""));
|
||||
assert!(format!("{:?}", E).contains("NotFound"));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user