From eb881a4b7798bb2f9766063e00e7b6aa10d15295 Mon Sep 17 00:00:00 2001 From: Chris Russell <8494645+chescock@users.noreply.github.com> Date: Mon, 14 Jul 2025 20:19:33 -0400 Subject: [PATCH] Add unit test that would have failed before the `init_state` changes. --- crates/bevy_ecs/src/world/entity_ref.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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;