Skip to content

Commit

Permalink
Fix failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
Stjepan Glavina committed Jan 13, 2019
1 parent 7915732 commit e449f3d
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/libcore/tests/iter.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use core::cell::Cell;
use core::iter::*;
use core::{i8, i16, isize};
use core::usize;
Expand Down Expand Up @@ -1908,19 +1909,19 @@ fn test_once() {

#[test]
fn test_once_with() {
let mut count = 0;
let mut count = Cell::new(0);
let mut it = once_with(|| {
count += 1;
count.set(count.get() + 1);
42
});

assert_eq!(count, 0);
assert_eq!(count.get(), 0);
assert_eq!(it.next(), Some(42));
assert_eq!(count, 1);
assert_eq!(count.get(), 1);
assert_eq!(it.next(), None);
assert_eq!(count, 1);
assert_eq!(count.get(), 1);
assert_eq!(it.next(), None);
assert_eq!(count, 1);
assert_eq!(count.get(), 1);
}

#[test]
Expand Down

0 comments on commit e449f3d

Please sign in to comment.