Skip to content

Commit 23b1304

Browse files
committed
Add a test for vec::retain
1 parent 3d54187 commit 23b1304

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/libcore/vec.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2799,6 +2799,13 @@ mod tests {
27992799
assert filter(~[1u, 2u, 4u, 8u, 16u], is_three) == ~[];
28002800
}
28012801

2802+
#[test]
2803+
fn test_retain() {
2804+
let mut v = ~[1, 2, 3, 4, 5];
2805+
v.retain(is_odd);
2806+
assert v == ~[1, 3, 5];
2807+
}
2808+
28022809
#[test]
28032810
fn test_foldl() {
28042811
// Test on-stack fold.

0 commit comments

Comments
 (0)