Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update test.
  • Loading branch information
m-ou-se committed Sep 29, 2021
commit a9c772aaf0d32136d5c74e195b8af4f9ee9451f5
9 changes: 7 additions & 2 deletions library/core/tests/cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,16 @@ fn smoketest_cell() {
fn cell_update() {
let x = Cell::new(10);

assert_eq!(x.update(|x| x + 5), 15);
x.update(|x| x + 5);
assert_eq!(x.get(), 15);

assert_eq!(x.update(|x| x / 3), 5);
x.update(|x| x / 3);
assert_eq!(x.get(), 5);

let x = Cell::new("abc".to_string());

x.update(|x| x + "123");
assert_eq!(x.take(), "abc123");
}

#[test]
Expand Down