Skip to content

Commit

Permalink
#79 tests added
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Apr 25, 2023
1 parent 925f6a9 commit 4fb2bb0
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/ctors.rs
Expand Up @@ -64,3 +64,25 @@ fn drops_correctly() -> Result<()> {
let _m: Map<Vec<u8>, u8, 8> = Map::new();
Ok(())
}

#[test]
#[ignore]
fn drops_keys() {
use std::rc::Rc;
let mut m: Map<Rc<()>, (), 8> = Map::new();
let k = Rc::new(());
m.insert(Rc::clone(&k), ());
drop(m);
assert_eq!(Rc::strong_count(&k), 1);
}

#[test]
#[ignore]
fn drops_values() {
use std::rc::Rc;
let mut m: Map<(), Rc<()>, 8> = Map::new();
let v = Rc::new(());
m.insert((), Rc::clone(&v));
drop(m);
assert_eq!(Rc::strong_count(&v), 1);
}

0 comments on commit 4fb2bb0

Please sign in to comment.