Skip to content

Commit 7330525

Browse files
committed
fixed tests again
1 parent ad240ea commit 7330525

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

src/libcore/tests/nonzero.rs

+12-14
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use core::num::{IntErrorKind, NonZeroU8, NonZeroU32, NonZeroI32, ParseIntError};
2-
use core::option::Option::{self, Some, None};
1+
use core::num::{IntErrorKind, NonZeroI32, NonZeroI8, NonZeroU32, NonZeroU8};
2+
use core::option::Option::{self, None, Some};
33
use std::mem::size_of;
44

55
#[test]
@@ -130,21 +130,19 @@ fn test_from_signed_nonzero() {
130130
fn test_from_str() {
131131
assert_eq!("123".parse::<NonZeroU8>(), Ok(NonZeroU8::new(123).unwrap()));
132132
assert_eq!(
133-
"0".parse::<NonZeroU8>(),
134-
Err(ParseIntError {
135-
kind: IntErrorKind::Zero
136-
})
133+
"0".parse::<NonZeroU8>().err().map(|e| e.kind().clone()),
134+
Some(IntErrorKind::Zero)
137135
);
138136
assert_eq!(
139-
"-1".parse::<NonZeroU8>(),
140-
Err(ParseIntError {
141-
kind: IntErrorKind::Underflow
142-
})
137+
"-1".parse::<NonZeroU8>().err().map(|e| e.kind().clone()),
138+
Some(IntErrorKind::InvalidDigit)
143139
);
144140
assert_eq!(
145-
"257".parse::<NonZeroU8>(),
146-
Err(ParseIntError {
147-
kind: IntErrorKind::Overflow
148-
})
141+
"-129".parse::<NonZeroI8>().err().map(|e| e.kind().clone()),
142+
Some(IntErrorKind::Underflow)
143+
);
144+
assert_eq!(
145+
"257".parse::<NonZeroU8>().err().map(|e| e.kind().clone()),
146+
Some(IntErrorKind::Overflow)
149147
);
150148
}

0 commit comments

Comments
 (0)