Add Splice forget test
This commit is contained in:
parent
7b86ba0d8d
commit
feae5a08a2
@ -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();
|
||||
|
@ -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];
|
||||
|
Loading…
x
Reference in New Issue
Block a user