FEAT: Rename .remove_opt() to .pop_at()

This commit is contained in:
bluss
2017-08-05 18:22:06 +02:00
parent cf76a83a7f
commit 313ebe8335
2 changed files with 23 additions and 8 deletions
+16
View File
@@ -434,3 +434,19 @@ fn test_drop_in_insert() {
}
assert_eq!(flag.get(), 3);
}
#[test]
fn test_pop_at() {
let mut v = ArrayVec::<[String; 4]>::new();
let s = String::from;
v.push(s("a"));
v.push(s("b"));
v.push(s("c"));
v.push(s("d"));
assert_eq!(v.pop_at(4), None);
assert_eq!(v.pop_at(1), Some(s("b")));
assert_eq!(v.pop_at(1), Some(s("c")));
assert_eq!(v.pop_at(2), None);
assert_eq!(&v[..], &["a", "d"]);
}