diff options
| author | Dylan DPC <dylan.dpc@gmail.com> | 2020-05-31 21:30:03 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-05-31 21:30:03 +0200 |
| commit | 5480120b26adcc336cef43f0c8045aaba4574359 (patch) | |
| tree | 96bc93edbcf71194fb3e673ce22d5fce6c01262c /src/libcore | |
| parent | 8e83a7e1262e8ff00496e23645e7fec3874b055c (diff) | |
| parent | 532dabdb8ef9536abc68c6adcdd9ca557c0e445a (diff) | |
| download | rust-5480120b26adcc336cef43f0c8045aaba4574359.tar.gz rust-5480120b26adcc336cef43f0c8045aaba4574359.zip | |
Rollup merge of #72812 - RalfJung:miri-char-test, r=jonas-schievink
Miri tests: skip parts of test_char_range The new `test_char_range` test takes forever in Miri as it loops over all values of `char`. This makes it skip most of them when being run in Miri.
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/tests/iter.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/libcore/tests/iter.rs b/src/libcore/tests/iter.rs index ab4f4aa7c73..3b854b56c32 100644 --- a/src/libcore/tests/iter.rs +++ b/src/libcore/tests/iter.rs @@ -1959,8 +1959,11 @@ fn test_range() { #[test] fn test_char_range() { use std::char; - assert!(('\0'..=char::MAX).eq((0..=char::MAX as u32).filter_map(char::from_u32))); - assert!(('\0'..=char::MAX).rev().eq((0..=char::MAX as u32).filter_map(char::from_u32).rev())); + // Miri is too slow + let from = if cfg!(miri) { char::from_u32(0xD800 - 10).unwrap() } else { '\0' }; + let to = if cfg!(miri) { char::from_u32(0xDFFF + 10).unwrap() } else { char::MAX }; + assert!((from..=to).eq((from as u32..=to as u32).filter_map(char::from_u32))); + assert!((from..=to).rev().eq((from as u32..=to as u32).filter_map(char::from_u32).rev())); assert_eq!(('\u{D7FF}'..='\u{E000}').count(), 2); assert_eq!(('\u{D7FF}'..='\u{E000}').size_hint(), (2, Some(2))); |
