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.
This commit is contained in:
Dylan DPC 2020-05-31 21:30:03 +02:00 committed by GitHub
commit 5480120b26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)));