Skip to content

Commit

Permalink
Add a new test that has cycles.
Browse files Browse the repository at this point in the history
Don't actually collect them yet because that's broken.
  • Loading branch information
jrmuizel committed Jul 27, 2019
1 parent 60a4696 commit e972a9e
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1106,4 +1106,30 @@ mod tests {
let x = Cc::new(map);
assert_eq!(x.get("Foo"), Some(&4));
}

#[test]
fn list_cycle() {
use std::cell::RefCell;

struct List(Vec<Cc<RefCell<List>>>);
impl Trace for List {
fn trace(&mut self, tracer: &mut Tracer) {
self.0.trace(tracer);
}
}
use collect::collect_cycles;
{
let a = Cc::new(RefCell::new(List(Vec::new())));
let b = Cc::new(RefCell::new(List(Vec::new())));
{
let mut a = a.borrow_mut();
a.0.push(b.clone());
}
{
let mut b = b.borrow_mut();
b.0.push(a.clone());
}
}
//collect_cycles();
}
}

0 comments on commit e972a9e

Please sign in to comment.