disable tests in Miri
This commit is contained in:
parent
d30b99f9c2
commit
81613ad7cf
20 changed files with 81 additions and 0 deletions
|
@ -1,3 +1,5 @@
|
||||||
|
#![cfg(not(miri))]
|
||||||
|
|
||||||
use std::any::Any;
|
use std::any::Any;
|
||||||
use std::sync::{Arc, Weak};
|
use std::sync::{Arc, Weak};
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
|
|
|
@ -282,6 +282,7 @@ fn assert_covariance() {
|
||||||
//
|
//
|
||||||
// Destructors must be called exactly once per element.
|
// Destructors must be called exactly once per element.
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg(not(miri))]
|
||||||
fn panic_safe() {
|
fn panic_safe() {
|
||||||
static DROP_COUNTER: AtomicUsize = AtomicUsize::new(0);
|
static DROP_COUNTER: AtomicUsize = AtomicUsize::new(0);
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#![cfg(not(miri))]
|
||||||
|
|
||||||
mod map;
|
mod map;
|
||||||
mod set;
|
mod set;
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#![cfg(not(miri))]
|
||||||
|
|
||||||
use std::alloc::{Global, Alloc, Layout, System};
|
use std::alloc::{Global, Alloc, Layout, System};
|
||||||
|
|
||||||
/// https://github.com/rust-lang/rust/issues/45955
|
/// https://github.com/rust-lang/rust/issues/45955
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#![cfg(not(miri))]
|
||||||
|
|
||||||
use std::any::Any;
|
use std::any::Any;
|
||||||
use std::rc::{Rc, Weak};
|
use std::rc::{Rc, Weak};
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#![cfg(not(miri))]
|
||||||
|
|
||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
use std::cmp::Ordering::{Equal, Greater, Less};
|
use std::cmp::Ordering::{Equal, Greater, Less};
|
||||||
use std::cmp::Ordering;
|
use std::cmp::Ordering;
|
||||||
|
|
|
@ -31,6 +31,7 @@ fn test_rfind() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg(not(miri))]
|
||||||
fn test_collect() {
|
fn test_collect() {
|
||||||
let empty = "";
|
let empty = "";
|
||||||
let s: String = empty.chars().collect();
|
let s: String = empty.chars().collect();
|
||||||
|
@ -118,6 +119,7 @@ fn test_concat_for_different_types() {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_concat_for_different_lengths() {
|
fn test_concat_for_different_lengths() {
|
||||||
let empty: &[&str] = &[];
|
let empty: &[&str] = &[];
|
||||||
|
#[cfg(not(miri))]
|
||||||
test_concat!("", empty);
|
test_concat!("", empty);
|
||||||
test_concat!("a", ["a"]);
|
test_concat!("a", ["a"]);
|
||||||
test_concat!("ab", ["a", "b"]);
|
test_concat!("ab", ["a", "b"]);
|
||||||
|
@ -146,6 +148,7 @@ fn test_join_for_different_types() {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_join_for_different_lengths() {
|
fn test_join_for_different_lengths() {
|
||||||
let empty: &[&str] = &[];
|
let empty: &[&str] = &[];
|
||||||
|
#[cfg(not(miri))]
|
||||||
test_join!("", empty, "-");
|
test_join!("", empty, "-");
|
||||||
test_join!("a", ["a"], "-");
|
test_join!("a", ["a"], "-");
|
||||||
test_join!("a-b", ["a", "b"], "-");
|
test_join!("a-b", ["a", "b"], "-");
|
||||||
|
@ -159,6 +162,7 @@ fn test_join_for_different_lengths_with_long_separator() {
|
||||||
assert_eq!("~~~~~".len(), 15);
|
assert_eq!("~~~~~".len(), 15);
|
||||||
|
|
||||||
let empty: &[&str] = &[];
|
let empty: &[&str] = &[];
|
||||||
|
#[cfg(not(miri))]
|
||||||
test_join!("", empty, "~~~~~");
|
test_join!("", empty, "~~~~~");
|
||||||
test_join!("a", ["a"], "~~~~~");
|
test_join!("a", ["a"], "~~~~~");
|
||||||
test_join!("a~~~~~b", ["a", "b"], "~~~~~");
|
test_join!("a~~~~~b", ["a", "b"], "~~~~~");
|
||||||
|
@ -166,6 +170,7 @@ fn test_join_for_different_lengths_with_long_separator() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg(not(miri))]
|
||||||
fn test_unsafe_slice() {
|
fn test_unsafe_slice() {
|
||||||
assert_eq!("ab", unsafe {"abc".get_unchecked(0..2)});
|
assert_eq!("ab", unsafe {"abc".get_unchecked(0..2)});
|
||||||
assert_eq!("bc", unsafe {"abc".get_unchecked(1..3)});
|
assert_eq!("bc", unsafe {"abc".get_unchecked(1..3)});
|
||||||
|
@ -238,6 +243,7 @@ fn test_replacen() {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_replace() {
|
fn test_replace() {
|
||||||
let a = "a";
|
let a = "a";
|
||||||
|
#[cfg(not(miri))]
|
||||||
assert_eq!("".replace(a, "b"), "");
|
assert_eq!("".replace(a, "b"), "");
|
||||||
assert_eq!("a".replace(a, "b"), "b");
|
assert_eq!("a".replace(a, "b"), "b");
|
||||||
assert_eq!("ab".replace(a, "b"), "bb");
|
assert_eq!("ab".replace(a, "b"), "bb");
|
||||||
|
@ -297,6 +303,7 @@ fn test_replace_pattern() {
|
||||||
// The current implementation of SliceIndex fails to handle methods
|
// The current implementation of SliceIndex fails to handle methods
|
||||||
// orthogonally from range types; therefore, it is worth testing
|
// orthogonally from range types; therefore, it is worth testing
|
||||||
// all of the indexing operations on each input.
|
// all of the indexing operations on each input.
|
||||||
|
#[cfg(not(miri))]
|
||||||
mod slice_index {
|
mod slice_index {
|
||||||
// Test a slicing operation **that should succeed,**
|
// Test a slicing operation **that should succeed,**
|
||||||
// testing it on all of the indexing methods.
|
// testing it on all of the indexing methods.
|
||||||
|
@ -679,6 +686,7 @@ fn test_str_slice_rangetoinclusive_ok() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[should_panic]
|
#[should_panic]
|
||||||
|
#[cfg(not(miri))]
|
||||||
fn test_str_slice_rangetoinclusive_notok() {
|
fn test_str_slice_rangetoinclusive_notok() {
|
||||||
let s = "abcαβγ";
|
let s = "abcαβγ";
|
||||||
&s[..=3];
|
&s[..=3];
|
||||||
|
@ -694,6 +702,7 @@ fn test_str_slicemut_rangetoinclusive_ok() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[should_panic]
|
#[should_panic]
|
||||||
|
#[cfg(not(miri))]
|
||||||
fn test_str_slicemut_rangetoinclusive_notok() {
|
fn test_str_slicemut_rangetoinclusive_notok() {
|
||||||
let mut s = "abcαβγ".to_owned();
|
let mut s = "abcαβγ".to_owned();
|
||||||
let s: &mut str = &mut s;
|
let s: &mut str = &mut s;
|
||||||
|
@ -883,6 +892,7 @@ fn test_as_bytes() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[should_panic]
|
#[should_panic]
|
||||||
|
#[cfg(not(miri))]
|
||||||
fn test_as_bytes_fail() {
|
fn test_as_bytes_fail() {
|
||||||
// Don't double free. (I'm not sure if this exercises the
|
// Don't double free. (I'm not sure if this exercises the
|
||||||
// original problem code path anymore.)
|
// original problem code path anymore.)
|
||||||
|
@ -972,6 +982,7 @@ fn test_split_at_mut() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[should_panic]
|
#[should_panic]
|
||||||
|
#[cfg(not(miri))]
|
||||||
fn test_split_at_boundscheck() {
|
fn test_split_at_boundscheck() {
|
||||||
let s = "ศไทย中华Việt Nam";
|
let s = "ศไทย中华Việt Nam";
|
||||||
s.split_at(1);
|
s.split_at(1);
|
||||||
|
@ -1066,6 +1077,7 @@ fn test_rev_iterator() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg(not(miri))]
|
||||||
fn test_chars_decoding() {
|
fn test_chars_decoding() {
|
||||||
let mut bytes = [0; 4];
|
let mut bytes = [0; 4];
|
||||||
for c in (0..0x110000).filter_map(::std::char::from_u32) {
|
for c in (0..0x110000).filter_map(::std::char::from_u32) {
|
||||||
|
@ -1077,6 +1089,7 @@ fn test_chars_decoding() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg(not(miri))]
|
||||||
fn test_chars_rev_decoding() {
|
fn test_chars_rev_decoding() {
|
||||||
let mut bytes = [0; 4];
|
let mut bytes = [0; 4];
|
||||||
for c in (0..0x110000).filter_map(::std::char::from_u32) {
|
for c in (0..0x110000).filter_map(::std::char::from_u32) {
|
||||||
|
@ -1306,6 +1319,7 @@ fn test_splitator() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg(not(miri))]
|
||||||
fn test_str_default() {
|
fn test_str_default() {
|
||||||
use std::default::Default;
|
use std::default::Default;
|
||||||
|
|
||||||
|
@ -1365,6 +1379,7 @@ fn test_bool_from_str() {
|
||||||
assert_eq!("not even a boolean".parse::<bool>().ok(), None);
|
assert_eq!("not even a boolean".parse::<bool>().ok(), None);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(miri))]
|
||||||
fn check_contains_all_substrings(s: &str) {
|
fn check_contains_all_substrings(s: &str) {
|
||||||
assert!(s.contains(""));
|
assert!(s.contains(""));
|
||||||
for i in 0..s.len() {
|
for i in 0..s.len() {
|
||||||
|
@ -1375,6 +1390,7 @@ fn check_contains_all_substrings(s: &str) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg(not(miri))]
|
||||||
fn strslice_issue_16589() {
|
fn strslice_issue_16589() {
|
||||||
assert!("bananas".contains("nana"));
|
assert!("bananas".contains("nana"));
|
||||||
|
|
||||||
|
@ -1384,6 +1400,7 @@ fn strslice_issue_16589() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg(not(miri))]
|
||||||
fn strslice_issue_16878() {
|
fn strslice_issue_16878() {
|
||||||
assert!(!"1234567ah012345678901ah".contains("hah"));
|
assert!(!"1234567ah012345678901ah".contains("hah"));
|
||||||
assert!(!"00abc01234567890123456789abc".contains("bcabc"));
|
assert!(!"00abc01234567890123456789abc".contains("bcabc"));
|
||||||
|
@ -1391,6 +1408,7 @@ fn strslice_issue_16878() {
|
||||||
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg(not(miri))]
|
||||||
fn test_strslice_contains() {
|
fn test_strslice_contains() {
|
||||||
let x = "There are moments, Jeeves, when one asks oneself, 'Do trousers matter?'";
|
let x = "There are moments, Jeeves, when one asks oneself, 'Do trousers matter?'";
|
||||||
check_contains_all_substrings(x);
|
check_contains_all_substrings(x);
|
||||||
|
@ -1528,6 +1546,7 @@ fn trim_ws() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn to_lowercase() {
|
fn to_lowercase() {
|
||||||
|
#[cfg(not(miri))]
|
||||||
assert_eq!("".to_lowercase(), "");
|
assert_eq!("".to_lowercase(), "");
|
||||||
assert_eq!("AÉDžaé ".to_lowercase(), "aédžaé ");
|
assert_eq!("AÉDžaé ".to_lowercase(), "aédžaé ");
|
||||||
|
|
||||||
|
@ -1561,6 +1580,7 @@ fn to_lowercase() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn to_uppercase() {
|
fn to_uppercase() {
|
||||||
|
#[cfg(not(miri))]
|
||||||
assert_eq!("".to_uppercase(), "");
|
assert_eq!("".to_uppercase(), "");
|
||||||
assert_eq!("aéDžßfiᾀ".to_uppercase(), "AÉDŽSSFIἈΙ");
|
assert_eq!("aéDžßfiᾀ".to_uppercase(), "AÉDŽSSFIἈΙ");
|
||||||
}
|
}
|
||||||
|
@ -1592,6 +1612,7 @@ fn test_cow_from() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg(not(miri))]
|
||||||
fn test_repeat() {
|
fn test_repeat() {
|
||||||
assert_eq!("".repeat(3), "");
|
assert_eq!("".repeat(3), "");
|
||||||
assert_eq!("abc".repeat(0), "");
|
assert_eq!("abc".repeat(0), "");
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#![cfg(not(miri))]
|
||||||
|
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::collections::CollectionAllocErr::*;
|
use std::collections::CollectionAllocErr::*;
|
||||||
use std::mem::size_of;
|
use std::mem::size_of;
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#![cfg(not(miri))]
|
||||||
|
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::mem::size_of;
|
use std::mem::size_of;
|
||||||
use std::{usize, isize};
|
use std::{usize, isize};
|
||||||
|
|
|
@ -107,6 +107,7 @@ fn test_index() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[should_panic]
|
#[should_panic]
|
||||||
|
#[cfg(not(miri))]
|
||||||
fn test_index_out_of_bounds() {
|
fn test_index_out_of_bounds() {
|
||||||
let mut deq = VecDeque::new();
|
let mut deq = VecDeque::new();
|
||||||
for i in 1..4 {
|
for i in 1..4 {
|
||||||
|
@ -905,20 +906,24 @@ fn test_append() {
|
||||||
// normal append
|
// normal append
|
||||||
a.append(&mut b);
|
a.append(&mut b);
|
||||||
assert_eq!(a.iter().cloned().collect::<Vec<_>>(), [1, 2, 3, 4, 5, 6]);
|
assert_eq!(a.iter().cloned().collect::<Vec<_>>(), [1, 2, 3, 4, 5, 6]);
|
||||||
|
#[cfg(not(miri))]
|
||||||
assert_eq!(b.iter().cloned().collect::<Vec<_>>(), []);
|
assert_eq!(b.iter().cloned().collect::<Vec<_>>(), []);
|
||||||
|
|
||||||
// append nothing to something
|
// append nothing to something
|
||||||
a.append(&mut b);
|
a.append(&mut b);
|
||||||
assert_eq!(a.iter().cloned().collect::<Vec<_>>(), [1, 2, 3, 4, 5, 6]);
|
assert_eq!(a.iter().cloned().collect::<Vec<_>>(), [1, 2, 3, 4, 5, 6]);
|
||||||
|
#[cfg(not(miri))]
|
||||||
assert_eq!(b.iter().cloned().collect::<Vec<_>>(), []);
|
assert_eq!(b.iter().cloned().collect::<Vec<_>>(), []);
|
||||||
|
|
||||||
// append something to nothing
|
// append something to nothing
|
||||||
b.append(&mut a);
|
b.append(&mut a);
|
||||||
assert_eq!(b.iter().cloned().collect::<Vec<_>>(), [1, 2, 3, 4, 5, 6]);
|
assert_eq!(b.iter().cloned().collect::<Vec<_>>(), [1, 2, 3, 4, 5, 6]);
|
||||||
|
#[cfg(not(miri))]
|
||||||
assert_eq!(a.iter().cloned().collect::<Vec<_>>(), []);
|
assert_eq!(a.iter().cloned().collect::<Vec<_>>(), []);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg(not(miri))]
|
||||||
fn test_append_permutations() {
|
fn test_append_permutations() {
|
||||||
fn construct_vec_deque(
|
fn construct_vec_deque(
|
||||||
push_back: usize,
|
push_back: usize,
|
||||||
|
@ -1119,6 +1124,7 @@ fn test_reserve_exact_2() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg(not(miri))]
|
||||||
fn test_try_reserve() {
|
fn test_try_reserve() {
|
||||||
|
|
||||||
// These are the interesting cases:
|
// These are the interesting cases:
|
||||||
|
@ -1220,6 +1226,7 @@ fn test_try_reserve() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg(not(miri))]
|
||||||
fn test_try_reserve_exact() {
|
fn test_try_reserve_exact() {
|
||||||
|
|
||||||
// This is exactly the same as test_try_reserve with the method changed.
|
// This is exactly the same as test_try_reserve with the method changed.
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#![cfg(not(miri))]
|
||||||
|
|
||||||
use core::cell::*;
|
use core::cell::*;
|
||||||
use core::default::Default;
|
use core::default::Default;
|
||||||
use std::mem::drop;
|
use std::mem::drop;
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#![cfg(not(miri))]
|
||||||
|
|
||||||
mod builders;
|
mod builders;
|
||||||
mod float;
|
mod float;
|
||||||
mod num;
|
mod num;
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#![cfg(not(miri))]
|
||||||
|
|
||||||
mod sip;
|
mod sip;
|
||||||
|
|
||||||
use std::hash::{Hash, Hasher};
|
use std::hash::{Hash, Hasher};
|
||||||
|
|
|
@ -190,6 +190,7 @@ fn test_iterator_step_by() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg(not(miri))]
|
||||||
fn test_iterator_step_by_nth() {
|
fn test_iterator_step_by_nth() {
|
||||||
let mut it = (0..16).step_by(5);
|
let mut it = (0..16).step_by(5);
|
||||||
assert_eq!(it.nth(0), Some(0));
|
assert_eq!(it.nth(0), Some(0));
|
||||||
|
@ -208,6 +209,7 @@ fn test_iterator_step_by_nth() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg(not(miri))]
|
||||||
fn test_iterator_step_by_nth_overflow() {
|
fn test_iterator_step_by_nth_overflow() {
|
||||||
#[cfg(target_pointer_width = "8")]
|
#[cfg(target_pointer_width = "8")]
|
||||||
type Bigger = u16;
|
type Bigger = u16;
|
||||||
|
@ -253,12 +255,14 @@ fn test_iterator_step_by_nth_overflow() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[should_panic]
|
#[should_panic]
|
||||||
|
#[cfg(not(miri))]
|
||||||
fn test_iterator_step_by_zero() {
|
fn test_iterator_step_by_zero() {
|
||||||
let mut it = (0..).step_by(0);
|
let mut it = (0..).step_by(0);
|
||||||
it.next();
|
it.next();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg(not(miri))]
|
||||||
fn test_iterator_step_by_size_hint() {
|
fn test_iterator_step_by_size_hint() {
|
||||||
struct StubSizeHint(usize, Option<usize>);
|
struct StubSizeHint(usize, Option<usize>);
|
||||||
impl Iterator for StubSizeHint {
|
impl Iterator for StubSizeHint {
|
||||||
|
@ -1413,6 +1417,7 @@ fn test_rposition() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[should_panic]
|
#[should_panic]
|
||||||
|
#[cfg(not(miri))]
|
||||||
fn test_rposition_panic() {
|
fn test_rposition_panic() {
|
||||||
let v: [(Box<_>, Box<_>); 4] =
|
let v: [(Box<_>, Box<_>); 4] =
|
||||||
[(box 0, box 0), (box 0, box 0),
|
[(box 0, box 0), (box 0, box 0),
|
||||||
|
@ -1652,6 +1657,7 @@ fn test_range_inclusive_nth() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg(not(miri))]
|
||||||
fn test_range_step() {
|
fn test_range_step() {
|
||||||
#![allow(deprecated)]
|
#![allow(deprecated)]
|
||||||
|
|
||||||
|
@ -1675,6 +1681,7 @@ fn test_range_step() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg(not(miri))]
|
||||||
fn test_step_by_skip() {
|
fn test_step_by_skip() {
|
||||||
assert_eq!((0..640).step_by(128).skip(1).collect::<Vec<_>>(), [128, 256, 384, 512]);
|
assert_eq!((0..640).step_by(128).skip(1).collect::<Vec<_>>(), [128, 256, 384, 512]);
|
||||||
assert_eq!((0..=50).step_by(10).nth(3), Some(30));
|
assert_eq!((0..=50).step_by(10).nth(3), Some(30));
|
||||||
|
@ -1682,6 +1689,7 @@ fn test_step_by_skip() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg(not(miri))]
|
||||||
fn test_range_inclusive_step() {
|
fn test_range_inclusive_step() {
|
||||||
assert_eq!((0..=50).step_by(10).collect::<Vec<_>>(), [0, 10, 20, 30, 40, 50]);
|
assert_eq!((0..=50).step_by(10).collect::<Vec<_>>(), [0, 10, 20, 30, 40, 50]);
|
||||||
assert_eq!((0..=5).step_by(1).collect::<Vec<_>>(), [0, 1, 2, 3, 4, 5]);
|
assert_eq!((0..=5).step_by(1).collect::<Vec<_>>(), [0, 1, 2, 3, 4, 5]);
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#![cfg(not(miri))]
|
||||||
|
|
||||||
use core::convert::{TryFrom, TryInto};
|
use core::convert::{TryFrom, TryInto};
|
||||||
use core::cmp::PartialEq;
|
use core::cmp::PartialEq;
|
||||||
use core::fmt::Debug;
|
use core::fmt::Debug;
|
||||||
|
|
|
@ -69,6 +69,7 @@ fn test_option_dance() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test] #[should_panic]
|
#[test] #[should_panic]
|
||||||
|
#[cfg(not(miri))]
|
||||||
fn test_option_too_much_dance() {
|
fn test_option_too_much_dance() {
|
||||||
struct A;
|
struct A;
|
||||||
let mut y = Some(A);
|
let mut y = Some(A);
|
||||||
|
@ -129,6 +130,7 @@ fn test_unwrap() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[should_panic]
|
#[should_panic]
|
||||||
|
#[cfg(not(miri))]
|
||||||
fn test_unwrap_panic1() {
|
fn test_unwrap_panic1() {
|
||||||
let x: Option<isize> = None;
|
let x: Option<isize> = None;
|
||||||
x.unwrap();
|
x.unwrap();
|
||||||
|
@ -136,6 +138,7 @@ fn test_unwrap_panic1() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[should_panic]
|
#[should_panic]
|
||||||
|
#[cfg(not(miri))]
|
||||||
fn test_unwrap_panic2() {
|
fn test_unwrap_panic2() {
|
||||||
let x: Option<String> = None;
|
let x: Option<String> = None;
|
||||||
x.unwrap();
|
x.unwrap();
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#![cfg(not(miri))]
|
||||||
|
|
||||||
use core::ptr::*;
|
use core::ptr::*;
|
||||||
use core::cell::RefCell;
|
use core::cell::RefCell;
|
||||||
|
|
||||||
|
|
|
@ -117,6 +117,7 @@ fn test_unwrap_or_else() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[should_panic]
|
#[should_panic]
|
||||||
|
#[cfg(not(miri))]
|
||||||
pub fn test_unwrap_or_else_panic() {
|
pub fn test_unwrap_or_else_panic() {
|
||||||
fn handler(msg: &'static str) -> isize {
|
fn handler(msg: &'static str) -> isize {
|
||||||
if msg == "I got this." {
|
if msg == "I got this." {
|
||||||
|
@ -138,6 +139,7 @@ pub fn test_expect_ok() {
|
||||||
}
|
}
|
||||||
#[test]
|
#[test]
|
||||||
#[should_panic(expected="Got expected error: \"All good\"")]
|
#[should_panic(expected="Got expected error: \"All good\"")]
|
||||||
|
#[cfg(not(miri))]
|
||||||
pub fn test_expect_err() {
|
pub fn test_expect_err() {
|
||||||
let err: Result<isize, &'static str> = Err("All good");
|
let err: Result<isize, &'static str> = Err("All good");
|
||||||
err.expect("Got expected error");
|
err.expect("Got expected error");
|
||||||
|
@ -151,6 +153,7 @@ pub fn test_expect_err_err() {
|
||||||
}
|
}
|
||||||
#[test]
|
#[test]
|
||||||
#[should_panic(expected="Got expected ok: \"All good\"")]
|
#[should_panic(expected="Got expected ok: \"All good\"")]
|
||||||
|
#[cfg(not(miri))]
|
||||||
pub fn test_expect_err_ok() {
|
pub fn test_expect_err_ok() {
|
||||||
let err: Result<&'static str, isize> = Ok("All good");
|
let err: Result<&'static str, isize> = Ok("All good");
|
||||||
err.expect_err("Got expected ok");
|
err.expect_err("Got expected ok");
|
||||||
|
|
|
@ -782,6 +782,7 @@ mod slice_index {
|
||||||
// to be used in `should_panic`)
|
// to be used in `should_panic`)
|
||||||
#[test]
|
#[test]
|
||||||
#[should_panic(expected = "out of range")]
|
#[should_panic(expected = "out of range")]
|
||||||
|
#[cfg(not(miri))]
|
||||||
fn assert_range_eq_can_fail_by_panic() {
|
fn assert_range_eq_can_fail_by_panic() {
|
||||||
assert_range_eq!([0, 1, 2], 0..5, [0, 1, 2]);
|
assert_range_eq!([0, 1, 2], 0..5, [0, 1, 2]);
|
||||||
}
|
}
|
||||||
|
@ -791,6 +792,7 @@ mod slice_index {
|
||||||
// to be used in `should_panic`)
|
// to be used in `should_panic`)
|
||||||
#[test]
|
#[test]
|
||||||
#[should_panic(expected = "==")]
|
#[should_panic(expected = "==")]
|
||||||
|
#[cfg(not(miri))]
|
||||||
fn assert_range_eq_can_fail_by_inequality() {
|
fn assert_range_eq_can_fail_by_inequality() {
|
||||||
assert_range_eq!([0, 1, 2], 0..2, [0, 1, 2]);
|
assert_range_eq!([0, 1, 2], 0..2, [0, 1, 2]);
|
||||||
}
|
}
|
||||||
|
@ -840,6 +842,7 @@ mod slice_index {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[should_panic(expected = $expect_msg)]
|
#[should_panic(expected = $expect_msg)]
|
||||||
|
#[cfg(not(miri))]
|
||||||
fn index_fail() {
|
fn index_fail() {
|
||||||
let v = $data;
|
let v = $data;
|
||||||
let v: &[_] = &v;
|
let v: &[_] = &v;
|
||||||
|
@ -848,6 +851,7 @@ mod slice_index {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[should_panic(expected = $expect_msg)]
|
#[should_panic(expected = $expect_msg)]
|
||||||
|
#[cfg(not(miri))]
|
||||||
fn index_mut_fail() {
|
fn index_mut_fail() {
|
||||||
let mut v = $data;
|
let mut v = $data;
|
||||||
let v: &mut [_] = &mut v;
|
let v: &mut [_] = &mut v;
|
||||||
|
@ -1011,6 +1015,7 @@ fn test_rotate_right() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(not(target_arch = "wasm32"))]
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
|
#[cfg(not(miri))]
|
||||||
fn sort_unstable() {
|
fn sort_unstable() {
|
||||||
use core::cmp::Ordering::{Equal, Greater, Less};
|
use core::cmp::Ordering::{Equal, Greater, Less};
|
||||||
use core::slice::heapsort;
|
use core::slice::heapsort;
|
||||||
|
@ -1166,6 +1171,7 @@ pub mod memchr {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg(not(miri))]
|
||||||
fn test_align_to_simple() {
|
fn test_align_to_simple() {
|
||||||
let bytes = [1u8, 2, 3, 4, 5, 6, 7];
|
let bytes = [1u8, 2, 3, 4, 5, 6, 7];
|
||||||
let (prefix, aligned, suffix) = unsafe { bytes.align_to::<u16>() };
|
let (prefix, aligned, suffix) = unsafe { bytes.align_to::<u16>() };
|
||||||
|
@ -1181,6 +1187,7 @@ fn test_align_to_simple() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg(not(miri))]
|
||||||
fn test_align_to_zst() {
|
fn test_align_to_zst() {
|
||||||
let bytes = [1, 2, 3, 4, 5, 6, 7];
|
let bytes = [1, 2, 3, 4, 5, 6, 7];
|
||||||
let (prefix, aligned, suffix) = unsafe { bytes.align_to::<()>() };
|
let (prefix, aligned, suffix) = unsafe { bytes.align_to::<()>() };
|
||||||
|
@ -1189,6 +1196,7 @@ fn test_align_to_zst() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg(not(miri))]
|
||||||
fn test_align_to_non_trivial() {
|
fn test_align_to_non_trivial() {
|
||||||
#[repr(align(8))] struct U64(u64, u64);
|
#[repr(align(8))] struct U64(u64, u64);
|
||||||
#[repr(align(8))] struct U64U64U32(u64, u64, u32);
|
#[repr(align(8))] struct U64U64U32(u64, u64, u32);
|
||||||
|
@ -1200,6 +1208,7 @@ fn test_align_to_non_trivial() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg(not(miri))]
|
||||||
fn test_align_to_empty_mid() {
|
fn test_align_to_empty_mid() {
|
||||||
use core::mem;
|
use core::mem;
|
||||||
|
|
||||||
|
@ -1297,6 +1306,7 @@ fn test_copy_within() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[should_panic(expected = "src is out of bounds")]
|
#[should_panic(expected = "src is out of bounds")]
|
||||||
|
#[cfg(not(miri))]
|
||||||
fn test_copy_within_panics_src_too_long() {
|
fn test_copy_within_panics_src_too_long() {
|
||||||
let mut bytes = *b"Hello, World!";
|
let mut bytes = *b"Hello, World!";
|
||||||
// The length is only 13, so 14 is out of bounds.
|
// The length is only 13, so 14 is out of bounds.
|
||||||
|
@ -1305,6 +1315,7 @@ fn test_copy_within_panics_src_too_long() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[should_panic(expected = "dest is out of bounds")]
|
#[should_panic(expected = "dest is out of bounds")]
|
||||||
|
#[cfg(not(miri))]
|
||||||
fn test_copy_within_panics_dest_too_long() {
|
fn test_copy_within_panics_dest_too_long() {
|
||||||
let mut bytes = *b"Hello, World!";
|
let mut bytes = *b"Hello, World!";
|
||||||
// The length is only 13, so a slice of length 4 starting at index 10 is out of bounds.
|
// The length is only 13, so a slice of length 4 starting at index 10 is out of bounds.
|
||||||
|
@ -1312,6 +1323,7 @@ fn test_copy_within_panics_dest_too_long() {
|
||||||
}
|
}
|
||||||
#[test]
|
#[test]
|
||||||
#[should_panic(expected = "src end is before src start")]
|
#[should_panic(expected = "src end is before src start")]
|
||||||
|
#[cfg(not(miri))]
|
||||||
fn test_copy_within_panics_src_inverted() {
|
fn test_copy_within_panics_src_inverted() {
|
||||||
let mut bytes = *b"Hello, World!";
|
let mut bytes = *b"Hello, World!";
|
||||||
// 2 is greater than 1, so this range is invalid.
|
// 2 is greater than 1, so this range is invalid.
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#![cfg(not(miri))]
|
||||||
|
|
||||||
use core::time::Duration;
|
use core::time::Duration;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue