Skip to content

Commit

Permalink
add unit test for Arena
Browse files Browse the repository at this point in the history
  • Loading branch information
droundy committed Apr 12, 2024
1 parent 09c003a commit f237a8e
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,20 @@ impl Arena {
)
}
}

#[test]
fn test_arena() {
let arena = Arena::new();
arena.with(|x: &mut i32| {
*x = 42;
});
arena.with(|x: &mut u32| {
*x = 137;
});
arena.with(|x: &mut i32| {
assert_eq!(*x, 42);
});
arena.with(|x: &mut u32| {
assert_eq!(*x, 137);
});
}

0 comments on commit f237a8e

Please sign in to comment.