Test and fix removal at past-the-end index

This commit is contained in:
Andreas Molzer
2020-01-18 13:24:58 +01:00
parent 26ff5dd822
commit fd28ecb105
2 changed files with 11 additions and 5 deletions
+8
View File
@@ -123,6 +123,14 @@ fn ArrayVec_remove() {
assert_eq!(&av[..], &[1, 3][..]);
}
#[test]
#[should_panic]
fn ArrayVec_remove_invalid() {
let mut av: ArrayVec<[i32; 1]> = Default::default();
av.push(1);
av.remove(1);
}
#[test]
fn ArrayVec_swap_remove() {
let mut av: ArrayVec<[i32; 10]> = Default::default();