Skip to content

Commit

Permalink
Add Splice forget test
Browse files Browse the repository at this point in the history
  • Loading branch information
mattico committed Apr 24, 2017
1 parent 7b86ba0 commit feae5a0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/libcollections/tests/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
8 changes: 8 additions & 0 deletions src/libcollections/tests/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down

0 comments on commit feae5a0

Please sign in to comment.