Add Splice forget test
This commit is contained in:
parent
7b86ba0d8d
commit
feae5a08a2
2 changed files with 15 additions and 0 deletions
|
@ -475,6 +475,13 @@ fn test_splice_unbounded() {
|
||||||
assert_eq!(t, "12345");
|
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]
|
#[test]
|
||||||
fn test_extend_ref() {
|
fn test_extend_ref() {
|
||||||
let mut a = "foo".to_string();
|
let mut a = "foo".to_string();
|
||||||
|
|
|
@ -634,6 +634,14 @@ fn test_splice_unbounded() {
|
||||||
assert_eq!(t, &[1, 2, 3, 4, 5]);
|
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]
|
#[test]
|
||||||
fn test_into_boxed_slice() {
|
fn test_into_boxed_slice() {
|
||||||
let xs = vec![1, 2, 3];
|
let xs = vec![1, 2, 3];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue