diff options
| author | Alexis Bourget <alexis.bourget@gmail.com> | 2020-06-08 19:17:05 +0200 |
|---|---|---|
| committer | Alexis Bourget <alexis.bourget@gmail.com> | 2020-06-08 19:34:34 +0200 |
| commit | 6c8d8d6a6055d19dc33cc8b33b082d17583a0e47 (patch) | |
| tree | 03f6f6017771982cffde57f2ff9a98909d88084e | |
| parent | 2b8e2f836f59db23630a06554b8e1a33f6c502f5 (diff) | |
| download | rust-6c8d8d6a6055d19dc33cc8b33b082d17583a0e47.tar.gz rust-6c8d8d6a6055d19dc33cc8b33b082d17583a0e47.zip | |
Fix test call for error case
| -rw-r--r-- | src/libcore/tests/nonzero.rs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/libcore/tests/nonzero.rs b/src/libcore/tests/nonzero.rs index 0a48d3d0ca9..48aec6d718d 100644 --- a/src/libcore/tests/nonzero.rs +++ b/src/libcore/tests/nonzero.rs @@ -1,5 +1,5 @@ use core::convert::TryFrom; -use core::num::{IntErrorKind, NonZeroI32, NonZeroI8, NonZeroU32, NonZeroU8, TryFromIntError}; +use core::num::{IntErrorKind, NonZeroI32, NonZeroI8, NonZeroU32, NonZeroU8}; use core::option::Option::{self, None, Some}; use std::mem::size_of; @@ -180,18 +180,18 @@ fn test_nonzero_bitor_assign() { #[test] fn test_nonzero_from_int_on_success() { - assert_eq!(NonZeroU8::try_from(5), Ok(NonZeroU8::new(5))); - assert_eq!(NonZeroU32::try_from(5), Ok(NonZeroU32::new(5))); + assert_eq!(NonZeroU8::try_from(5), Ok(NonZeroU8::new(5).unwrap())); + assert_eq!(NonZeroU32::try_from(5), Ok(NonZeroU32::new(5).unwrap())); - assert_eq!(NonZeroI8::try_from(-5), Ok(NonZeroI8::new(-5))); - assert_eq!(NonZeroI32::try_from(-5), Ok(NonZeroI32::new(-5))); + assert_eq!(NonZeroI8::try_from(-5), Ok(NonZeroI8::new(-5).unwrap())); + assert_eq!(NonZeroI32::try_from(-5), Ok(NonZeroI32::new(-5).unwrap())); } #[test] fn test_nonzero_from_int_on_err() { - assert_eq!(NonZeroU8::try_from(0), Err(TryFromIntError(()))); - assert_eq!(NonZeroU32::try_from(0), Err(TryFromIntError(()))); + assert!(NonZeroU8::try_from(0).is_err()); + assert!(NonZeroU32::try_from(0).is_err()); - assert_eq!(NonZeroI8::try_from(0), Err(TryFromIntError(()))); - assert_eq!(NonZeroI32::try_from(0), Err(TryFromIntError(()))); + assert!(NonZeroI8::try_from(0).is_err()); + assert!(NonZeroI32::try_from(0).is_err()); } |
