Skip to content

Commit

Permalink
Add test for mem_swap with Rt
Browse files Browse the repository at this point in the history
  • Loading branch information
CeleritasCelery committed Apr 28, 2023
1 parent f846d79 commit db0ac8a
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/core/gc/root.rs
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,21 @@ mod test {
use super::super::RootSet;
use super::*;

#[test]
fn mem_swap() {
let root = &RootSet::default();
let cx = &mut Context::new(root);
let outer = cx.add("outer");
root!(outer, cx);
{
let inner = cx.add("inner");
root!(inner, cx);
std::mem::swap(outer, inner);
}
cx.garbage_collect(true);
assert_eq!(outer.bind(cx), "inner");
}

#[test]
fn indexing() {
let root = &RootSet::default();
Expand Down

0 comments on commit db0ac8a

Please sign in to comment.