}
#[test]
-#[cfg(not(miri))]
fn test_collect() {
let empty = "";
let s: String = empty.chars().collect();
#[test]
fn test_concat_for_different_lengths() {
let empty: &[&str] = &[];
- #[cfg(not(miri))]
test_concat!("", empty);
test_concat!("a", ["a"]);
test_concat!("ab", ["a", "b"]);
#[test]
fn test_join_for_different_lengths() {
let empty: &[&str] = &[];
- #[cfg(not(miri))]
test_join!("", empty, "-");
test_join!("a", ["a"], "-");
test_join!("a-b", ["a", "b"], "-");
assert_eq!("~~~~~".len(), 15);
let empty: &[&str] = &[];
- #[cfg(not(miri))]
test_join!("", empty, "~~~~~");
test_join!("a", ["a"], "~~~~~");
test_join!("a~~~~~b", ["a", "b"], "~~~~~");
}
#[test]
-#[cfg(not(miri))]
+#[cfg(not(miri))] // Miri is too slow
fn test_unsafe_slice() {
assert_eq!("ab", unsafe {"abc".get_unchecked(0..2)});
assert_eq!("bc", unsafe {"abc".get_unchecked(1..3)});
#[test]
fn test_replace() {
let a = "a";
- #[cfg(not(miri))]
assert_eq!("".replace(a, "b"), "");
assert_eq!("a".replace(a, "b"), "b");
assert_eq!("ab".replace(a, "b"), "bb");
// The current implementation of SliceIndex fails to handle methods
// orthogonally from range types; therefore, it is worth testing
// all of the indexing operations on each input.
-#[cfg(not(miri))]
mod slice_index {
// Test a slicing operation **that should succeed,**
// testing it on all of the indexing methods.
// to be used in `should_panic`)
#[test]
#[should_panic(expected = "out of bounds")]
+ #[cfg(not(miri))] // Miri does not support panics
fn assert_range_eq_can_fail_by_panic() {
assert_range_eq!("abc", 0..5, "abc");
}
// to be used in `should_panic`)
#[test]
#[should_panic(expected = "==")]
+ #[cfg(not(miri))] // Miri does not support panics
fn assert_range_eq_can_fail_by_inequality() {
assert_range_eq!("abc", 0..2, "abc");
}
#[test]
#[should_panic(expected = $expect_msg)]
+ #[cfg(not(miri))] // Miri does not support panics
fn index_fail() {
let v: String = $data.into();
let v: &str = &v;
#[test]
#[should_panic(expected = $expect_msg)]
+ #[cfg(not(miri))] // Miri does not support panics
fn index_mut_fail() {
let mut v: String = $data.into();
let v: &mut str = &mut v;
#[test]
#[cfg(not(target_arch = "asmjs"))] // hits an OOM
+ #[cfg(not(miri))] // Miri is too slow
fn simple_big() {
fn a_million_letter_x() -> String {
let mut i = 0;
#[test]
#[should_panic]
+ #[cfg(not(miri))] // Miri does not support panics
fn test_slice_fail() {
&"中华Việt Nam"[0..2];
}
// check the panic includes the prefix of the sliced string
#[test]
#[should_panic(expected="byte index 1024 is out of bounds of `Lorem ipsum dolor sit amet")]
+ #[cfg(not(miri))] // Miri does not support panics
fn test_slice_fail_truncated_1() {
&LOREM_PARAGRAPH[..1024];
}
// check the truncation in the panic message
#[test]
#[should_panic(expected="luctus, im`[...]")]
+ #[cfg(not(miri))] // Miri does not support panics
fn test_slice_fail_truncated_2() {
&LOREM_PARAGRAPH[..1024];
}
#[test]
#[should_panic]
-#[cfg(not(miri))]
+#[cfg(not(miri))] // Miri does not support panics
fn test_str_slice_rangetoinclusive_notok() {
let s = "abcαβγ";
&s[..=3];
#[test]
#[should_panic]
-#[cfg(not(miri))]
+#[cfg(not(miri))] // Miri does not support panics
fn test_str_slicemut_rangetoinclusive_notok() {
let mut s = "abcαβγ".to_owned();
let s: &mut str = &mut s;
#[test]
#[should_panic]
-#[cfg(not(miri))]
+#[cfg(not(miri))] // Miri does not support panics
fn test_as_bytes_fail() {
// Don't double free. (I'm not sure if this exercises the
// original problem code path anymore.)
#[test]
#[should_panic]
-#[cfg(not(miri))]
+#[cfg(not(miri))] // Miri does not support panics
fn test_split_at_boundscheck() {
let s = "ศไทย中华Việt Nam";
s.split_at(1);
}
#[test]
-#[cfg(not(miri))]
+#[cfg(not(miri))] // Miri is too slow
fn test_chars_decoding() {
let mut bytes = [0; 4];
for c in (0..0x110000).filter_map(std::char::from_u32) {
}
#[test]
-#[cfg(not(miri))]
+#[cfg(not(miri))] // Miri is too slow
fn test_chars_rev_decoding() {
let mut bytes = [0; 4];
for c in (0..0x110000).filter_map(std::char::from_u32) {
}
#[test]
-#[cfg(not(miri))]
fn test_str_default() {
use std::default::Default;
assert_eq!("not even a boolean".parse::<bool>().ok(), None);
}
-#[cfg(not(miri))]
+#[cfg(not(miri))] // Miri is too slow
fn check_contains_all_substrings(s: &str) {
assert!(s.contains(""));
for i in 0..s.len() {
}
#[test]
-#[cfg(not(miri))]
+#[cfg(not(miri))] // Miri is too slow
fn strslice_issue_16589() {
assert!("bananas".contains("nana"));
}
#[test]
-#[cfg(not(miri))]
fn strslice_issue_16878() {
assert!(!"1234567ah012345678901ah".contains("hah"));
assert!(!"00abc01234567890123456789abc".contains("bcabc"));
#[test]
-#[cfg(not(miri))]
+#[cfg(not(miri))] // Miri is too slow
fn test_strslice_contains() {
let x = "There are moments, Jeeves, when one asks oneself, 'Do trousers matter?'";
check_contains_all_substrings(x);
#[test]
fn to_lowercase() {
- #[cfg(not(miri))]
assert_eq!("".to_lowercase(), "");
assert_eq!("AÉDžaé ".to_lowercase(), "aédžaé ");
#[test]
fn to_uppercase() {
- #[cfg(not(miri))]
assert_eq!("".to_uppercase(), "");
assert_eq!("aéDžßfiᾀ".to_uppercase(), "AÉDŽSSFIἈΙ");
}
}
#[test]
-#[cfg(not(miri))]
fn test_repeat() {
assert_eq!("".repeat(3), "");
assert_eq!("abc".repeat(0), "");