Flush effects when dropping a TestAppContext

This way, at the end of a test, dropped entities will be removed, and will drop
the handles that they hold.
This commit is contained in:
Max Brunsfeld 2022-02-28 22:17:20 -08:00
parent 7d53e37672
commit 426e0e3d4f

View file

@ -565,6 +565,12 @@ impl TestAppContext {
} }
} }
impl Drop for TestAppContext {
fn drop(&mut self) {
self.cx.borrow_mut().flush_effects();
}
}
impl AsyncAppContext { impl AsyncAppContext {
pub fn spawn<F, Fut, T>(&self, f: F) -> Task<T> pub fn spawn<F, Fut, T>(&self, f: F) -> Task<T>
where where