about summary refs log tree commit diff
path: root/src/libcore/tests
diff options
context:
space:
mode:
authorMarcel Hellwig <git@cookiesoft.de>2019-02-28 20:48:08 +0100
committerMarcel Hellwig <git@cookiesoft.de>2019-02-28 21:00:41 +0100
commit7330525e8fa8e873bc7feeb476fa161d20786a43 (patch)
treeb483bcc0ef7fa3a300fb387a08096110fc6bd6e6 /src/libcore/tests
parentad240ea70c2ba4b4a03286320a7909e485507d75 (diff)
downloadrust-7330525e8fa8e873bc7feeb476fa161d20786a43.tar.gz
rust-7330525e8fa8e873bc7feeb476fa161d20786a43.zip
fixed tests again
Diffstat (limited to 'src/libcore/tests')
-rw-r--r--src/libcore/tests/nonzero.rs26
1 files changed, 12 insertions, 14 deletions
diff --git a/src/libcore/tests/nonzero.rs b/src/libcore/tests/nonzero.rs
index 8e2d4177d08..77e484601bc 100644
--- a/src/libcore/tests/nonzero.rs
+++ b/src/libcore/tests/nonzero.rs
@@ -1,5 +1,5 @@
-use core::num::{IntErrorKind, NonZeroU8, NonZeroU32, NonZeroI32, ParseIntError};
-use core::option::Option::{self, Some, None};
+use core::num::{IntErrorKind, NonZeroI32, NonZeroI8, NonZeroU32, NonZeroU8};
+use core::option::Option::{self, None, Some};
 use std::mem::size_of;
 
 #[test]
@@ -130,21 +130,19 @@ fn test_from_signed_nonzero() {
 fn test_from_str() {
     assert_eq!("123".parse::<NonZeroU8>(), Ok(NonZeroU8::new(123).unwrap()));
     assert_eq!(
-        "0".parse::<NonZeroU8>(),
-        Err(ParseIntError {
-            kind: IntErrorKind::Zero
-        })
+        "0".parse::<NonZeroU8>().err().map(|e| e.kind().clone()),
+        Some(IntErrorKind::Zero)
     );
     assert_eq!(
-        "-1".parse::<NonZeroU8>(),
-        Err(ParseIntError {
-            kind: IntErrorKind::Underflow
-        })
+        "-1".parse::<NonZeroU8>().err().map(|e| e.kind().clone()),
+        Some(IntErrorKind::InvalidDigit)
     );
     assert_eq!(
-        "257".parse::<NonZeroU8>(),
-        Err(ParseIntError {
-            kind: IntErrorKind::Overflow
-        })
+        "-129".parse::<NonZeroI8>().err().map(|e| e.kind().clone()),
+        Some(IntErrorKind::Underflow)
+    );
+    assert_eq!(
+        "257".parse::<NonZeroU8>().err().map(|e| e.kind().clone()),
+        Some(IntErrorKind::Overflow)
     );
 }