Skip to content

Commit

Permalink
Add unit test with system that panics (#7491)
Browse files Browse the repository at this point in the history
# Objective

Fixes #7434.

This is my first time contributing to a Rust project, so please let me know if this wasn't the change intended by the linked issue.

## Solution

Adds a test with a system that panics to `bevy_ecs`.

I'm not sure if this is the intended panic message, but this is what the test currently results in:
```
thread 'system::tests::panic_inside_system' panicked at 'called `Option::unwrap()` on a `None` value', /Users/bjorn/workplace/bevy/crates/bevy_tasks/src/task_pool.rs:354:49
```
  • Loading branch information
bjrnt committed Feb 3, 2023
1 parent 3900b48 commit 6506ea4
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions crates/bevy_ecs/src/system/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1212,4 +1212,11 @@ mod tests {
let query = unsafe { Query::new(&world2, &qstate, 0, 0, false) };
query.iter();
}

#[test]
#[should_panic]
fn panic_inside_system() {
let mut world = World::new();
run_system(&mut world, || panic!("this system panics"));
}
}

0 comments on commit 6506ea4

Please sign in to comment.