about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatt Ickstadt <mattico8@gmail.com>2017-04-24 09:49:29 -0500
committerMatt Ickstadt <mattico8@gmail.com>2017-04-24 09:49:29 -0500
commitfeae5a08a2d5d8db14a4b99a050dbc14a6bffb2a (patch)
treefed511462143cb4ca7d9ae5b364ccdb7aea73bc0
parent7b86ba0d8de53fece3c5e4a522dbde123f483a7c (diff)
downloadrust-feae5a08a2d5d8db14a4b99a050dbc14a6bffb2a.tar.gz
rust-feae5a08a2d5d8db14a4b99a050dbc14a6bffb2a.zip
Add Splice forget test
-rw-r--r--src/libcollections/tests/string.rs7
-rw-r--r--src/libcollections/tests/vec.rs8
2 files changed, 15 insertions, 0 deletions
diff --git a/src/libcollections/tests/string.rs b/src/libcollections/tests/string.rs
index a32f5e3357f..b1731b2a5dc 100644
--- a/src/libcollections/tests/string.rs
+++ b/src/libcollections/tests/string.rs
@@ -476,6 +476,13 @@ fn test_splice_unbounded() {
 }
 
 #[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();
     a.extend(&['b', 'a', 'r']);
diff --git a/src/libcollections/tests/vec.rs b/src/libcollections/tests/vec.rs
index f47940dc33a..29f18274962 100644
--- a/src/libcollections/tests/vec.rs
+++ b/src/libcollections/tests/vec.rs
@@ -635,6 +635,14 @@ fn test_splice_unbounded() {
 }
 
 #[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];
     let ys = xs.into_boxed_slice();