Skip to content

Commit

Permalink
add test for panicking in run_as_context
Browse files Browse the repository at this point in the history
  • Loading branch information
autumnontape committed Sep 30, 2020
1 parent 95d48b8 commit f3f10e9
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/internals/serialize/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -565,4 +565,19 @@ mod test {

assert_eq!(8, world.len());
}

#[test]
fn run_as_context_panic() {
std::panic::catch_unwind(|| {
let registry = Registry::<i32>::default();

super::WorldSerializer::with_entity_serializer(&registry, &mut |canon| {
super::id::run_as_context(canon, || panic!());
});
})
.unwrap_err();

// run the serialize_bincode test again
serialize_bincode();
}
}

0 comments on commit f3f10e9

Please sign in to comment.