about summary refs log tree commit diff
path: root/src/libcore/tests
diff options
context:
space:
mode:
author@amit.chandra <@amit.chandra>2019-05-01 23:34:07 +0530
committerwizAmit <amitforfriends_dns@yahoo.com>2019-05-14 12:26:25 +0530
commitaff83c80dd162b43a301e2bea73762cc4560f0f3 (patch)
tree8ec6564e651b1db8482d63c27546069bc3598d9e /src/libcore/tests
parent02a148dba261439626c5020a7cbb15e690521e87 (diff)
downloadrust-aff83c80dd162b43a301e2bea73762cc4560f0f3.tar.gz
rust-aff83c80dd162b43a301e2bea73762cc4560f0f3.zip
hopefully working nth_back on chunks
Signed-off-by: wizAmit <amitforfriends_dns@yahoo.com>
Diffstat (limited to 'src/libcore/tests')
-rw-r--r--src/libcore/tests/slice.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/libcore/tests/slice.rs b/src/libcore/tests/slice.rs
index 0233b96d3a7..edea405fad7 100644
--- a/src/libcore/tests/slice.rs
+++ b/src/libcore/tests/slice.rs
@@ -139,12 +139,19 @@ fn test_chunks_nth_back() {
     let v: &[i32] = &[0, 1, 2, 3, 4, 5];
     let mut c = v.chunks(2);
     assert_eq!(c.nth_back(1).unwrap(), &[2, 3]);
-    assert_eq!(c.next().unwrap(), &[4, 5]);
+    assert_eq!(c.next().unwrap(), &[0, 1]);
+    assert_eq!(c.next(), None);
 
     let v2: &[i32] = &[0, 1, 2, 3, 4];
     let mut c2 = v2.chunks(3);
     assert_eq!(c2.nth_back(1).unwrap(), &[0, 1]);
     assert_eq!(c2.next(), None);
+    assert_eq!(c2.next_back(), None);
+
+    let v3: &[i32] = &[0, 1, 2, 3, 4];
+    let mut c3 = v3.chunks(10);
+    assert_eq!(c3.nth_back(0).unwrap(), &[0, 1, 2, 3, 4]);
+    assert_eq!(c3.next(), None);
 }
 
 #[test]