Add Splice forget test

This commit is contained in:
Matt Ickstadt 2017-04-24 09:49:29 -05:00
parent 7b86ba0d8d
commit feae5a08a2
2 changed files with 15 additions and 0 deletions

View File

@ -475,6 +475,13 @@ fn test_splice_unbounded() {
assert_eq!(t, "12345");
}
#[test]
fn test_splice_forget() {
let mut s = String::from("12345");
::std::mem::forget(s.splice(2..4, "789"));
assert_eq!(s, "12345");
}
#[test]
fn test_extend_ref() {
let mut a = "foo".to_string();

View File

@ -634,6 +634,14 @@ fn test_splice_unbounded() {
assert_eq!(t, &[1, 2, 3, 4, 5]);
}
#[test]
fn test_splice_forget() {
let mut v = vec![1, 2, 3, 4, 5];
let a = [10, 11, 12];
::std::mem::forget(v.splice(2..4, a.iter().cloned()));
assert_eq!(v, &[1, 2]);
}
#[test]
fn test_into_boxed_slice() {
let xs = vec![1, 2, 3];