Why does this test not fail?
use bevy::ecs::system::SystemState;
fn test_commands(
mut commands: Commands,
) {
for _many_times in [0..20] {
commands.spawn_empty();
}
}
#[test]
fn modify_world_for_unit_test() {
let mut world = World::default();
let mut count_before_running_system_and_applying_commands = world.entities().len();
let mut system_state: SystemState<Commands> = SystemState::new(&mut world);
let mut commands = system_state.get_mut(&mut world);
// Run the system, which puts commands into the SystemState's internal queue, supposedly
test_commands(commands);
world.increment_change_tick();
// Apply the commands
system_state.apply(&mut world);
let mut count_after_apply = world.entities().len();
assert_ne!(count_before_running_system_and_applying_commands, count_after_apply);
}