diff --git a/crates/bevy_ecs/src/world/entity_ref.rs b/crates/bevy_ecs/src/world/entity_ref.rs index 0b850f816b..e2977c814d 100644 --- a/crates/bevy_ecs/src/world/entity_ref.rs +++ b/crates/bevy_ecs/src/world/entity_ref.rs @@ -5374,6 +5374,19 @@ mod tests { } } + #[test] + fn entity_mut_except_registers_components() { + // Checks for a bug where `EntityMutExcept` would not register the component and + // would therefore not include an exception, causing it to conflict with the later query. + fn system1(_query: Query>, _: Query<&mut TestComponent>) {} + let mut world = World::new(); + world.run_system_once(system1).unwrap(); + + fn system2(_: Query<&mut TestComponent>, _query: Query>) {} + let mut world = World::new(); + world.run_system_once(system2).unwrap(); + } + #[derive(Component)] struct A;