mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-21 17:52:12 +03:00
Fix failing test
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
use core::cell::Cell;
|
||||
use core::iter::*;
|
||||
use core::{i8, i16, isize};
|
||||
use core::usize;
|
||||
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user