Skip to content

Commit 378274b

Browse files
authored
Rollup merge of rust-lang#76324 - ayushmishra2005:move_vec_tests_in_library, r=matklad
Move Vec slice UI tests in library Moved some of Vec slice UI tests in Library as a part of rust-lang#76268 r? @matklad
2 parents 97cd85d + d16bbd1 commit 378274b

File tree

2 files changed

+23
-62
lines changed

2 files changed

+23
-62
lines changed

library/alloc/tests/vec.rs

+23
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,29 @@ fn test_zip_unzip() {
401401
assert_eq!((3, 6), (left[2], right[2]));
402402
}
403403

404+
#[test]
405+
fn test_cmp() {
406+
let x: &[isize] = &[1, 2, 3, 4, 5];
407+
let cmp: &[isize] = &[1, 2, 3, 4, 5];
408+
assert_eq!(&x[..], cmp);
409+
let cmp: &[isize] = &[3, 4, 5];
410+
assert_eq!(&x[2..], cmp);
411+
let cmp: &[isize] = &[1, 2, 3];
412+
assert_eq!(&x[..3], cmp);
413+
let cmp: &[isize] = &[2, 3, 4];
414+
assert_eq!(&x[1..4], cmp);
415+
416+
let x: Vec<isize> = vec![1, 2, 3, 4, 5];
417+
let cmp: &[isize] = &[1, 2, 3, 4, 5];
418+
assert_eq!(&x[..], cmp);
419+
let cmp: &[isize] = &[3, 4, 5];
420+
assert_eq!(&x[2..], cmp);
421+
let cmp: &[isize] = &[1, 2, 3];
422+
assert_eq!(&x[..3], cmp);
423+
let cmp: &[isize] = &[2, 3, 4];
424+
assert_eq!(&x[1..4], cmp);
425+
}
426+
404427
#[test]
405428
fn test_vec_truncate_drop() {
406429
static mut DROPS: u32 = 0;

src/test/ui/array-slice-vec/slice-2.rs

-62
This file was deleted.

0 commit comments

Comments
 (0)