about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2020-05-31 11:58:15 +0200
committerRalf Jung <post@ralfj.de>2020-05-31 12:12:45 +0200
commit532dabdb8ef9536abc68c6adcdd9ca557c0e445a (patch)
tree5c71e577972190e3e0b074a682b2622b8323ed73
parentb6fa392238a459c29a47e2cf824d79a49a8ba039 (diff)
downloadrust-532dabdb8ef9536abc68c6adcdd9ca557c0e445a.tar.gz
rust-532dabdb8ef9536abc68c6adcdd9ca557c0e445a.zip
Miri tests: skip parts of test_char_range
-rw-r--r--src/libcore/tests/iter.rs7
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)));