fix test for .iter().sort() to include data to sort (#18127)

The test case `query_iter_sorts` was doing lots of comparisons to ensure
that various query arrays were sorted, but the arrays were all empty.

This PR spawns some entities so that the entity lists to compare not
empty, and sorting can actually be tested for correctness.
This commit is contained in:
Nathan Fenner 2025-03-02 22:24:43 -08:00 committed by GitHub
parent f42ecc44f8
commit 755adae0f8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2602,10 +2602,16 @@ mod tests {
#[test]
fn query_iter_sorts() {
let mut world = World::new();
for i in 0..100 {
world.spawn(A(i as f32));
world.spawn((A(i as f32), Sparse(i)));
world.spawn(Sparse(i));
}
let mut query = world.query::<Entity>();
let sort = query.iter(&world).sort::<Entity>().collect::<Vec<_>>();
assert_eq!(sort.len(), 300);
let sort_unstable = query
.iter(&world)