@@ -1406,14 +1406,18 @@ mod tests {
14061406 let num = 42 ;
14071407
14081408 let component_id = world. init_component :: < TestComponent > ( ) ;
1409- world. spawn ( TestComponent ( num) ) ;
1409+ let spawned_entity = world. spawn ( TestComponent ( num) ) . id ( ) ;
14101410
1411- let mut query_state =
1412- QueryState :: < Ptr < ' _ > , ( ) > :: new_with_config ( & mut world, component_id, ( ) ) ;
1411+ let mut query_state = QueryState :: < ( Entity , Ptr < ' _ > ) , ( ) > :: new_with_config (
1412+ & mut world,
1413+ ( ( ) , component_id) ,
1414+ ( ) ,
1415+ ) ;
14131416
14141417 let results: Vec < _ > = query_state. iter ( & world) . collect ( ) ;
14151418 match results. as_slice ( ) {
1416- [ value] => {
1419+ [ ( entity, value) ] => {
1420+ assert_eq ! ( * entity, spawned_entity) ;
14171421 // SAFETY: correct type, read access
14181422 let value = unsafe { value. deref :: < TestComponent > ( ) } ;
14191423 assert_eq ! ( value. 0 , num) ;
@@ -1432,17 +1436,20 @@ mod tests {
14321436 let component_id_1 = world. init_component :: < TestComponent > ( ) ;
14331437 let component_id_2 = world. init_component :: < TestComponent2 > ( ) ;
14341438
1435- world. spawn ( ( TestComponent ( num_1) , TestComponent2 ( num_2) ) ) ;
1439+ let spawned_entity = world
1440+ . spawn ( ( TestComponent ( num_1) , TestComponent2 ( num_2) ) )
1441+ . id ( ) ;
14361442
1437- let mut query_state = QueryState :: < Vec < Ptr < ' _ > > , ( ) > :: new_with_config (
1443+ let mut query_state = QueryState :: < ( Entity , Vec < Ptr < ' _ > > ) , ( ) > :: new_with_config (
14381444 & mut world,
1439- vec ! [ component_id_1, component_id_2] ,
1445+ ( ( ) , vec ! [ component_id_1, component_id_2] ) ,
14401446 ( ) ,
14411447 ) ;
14421448
14431449 let results: Vec < _ > = query_state. iter ( & world) . collect ( ) ;
14441450 match results. as_slice ( ) {
1445- [ result] => {
1451+ [ ( entity, result) ] => {
1452+ assert_eq ! ( * entity, spawned_entity) ;
14461453 match result. as_slice ( ) {
14471454 [ val_1, val_2] => {
14481455 // SAFETY: correct type, read access
0 commit comments