mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-24 07:44:10 +00:00
Fix test call for error case
This commit is contained in:
parent
2b8e2f836f
commit
6c8d8d6a60
@ -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());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user