diff options
| -rw-r--r-- | library/core/tests/result.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/library/core/tests/result.rs b/library/core/tests/result.rs index 5fcd7b4d3a3..c461ab380ad 100644 --- a/library/core/tests/result.rs +++ b/library/core/tests/result.rs @@ -226,6 +226,28 @@ pub fn test_into_ok() { } #[test] +pub fn test_into_err() { + fn until_error_op() -> Result<!, isize> { + Err(666) + } + + assert_eq!(until_error_op().into_err(), 666); + + enum MyNeverToken {} + impl From<MyNeverToken> for ! { + fn from(never: MyNeverToken) -> ! { + match never {} + } + } + + fn until_error_op2() -> Result<MyNeverToken, isize> { + Err(667) + } + + assert_eq!(until_error_op2().into_err(), 667); +} + +#[test] fn test_try() { fn try_result_some() -> Option<u8> { let val = Ok(1)?; |
