@@ -115,13 +115,14 @@ pub(crate) fn entity_labels_system(
115
115
#[ cfg( test) ]
116
116
mod tests {
117
117
use super :: * ;
118
+ use bevy_ecs:: Stage ;
118
119
119
120
fn setup ( ) -> ( World , Resources , bevy_ecs:: Schedule ) {
120
121
let world = World :: new ( ) ;
121
122
let mut resources = Resources :: default ( ) ;
122
123
resources. insert ( EntityLabels :: default ( ) ) ;
123
124
let mut schedule = bevy_ecs:: Schedule :: default ( ) ;
124
- schedule. add_stage ( "test" , SystemStage :: serial ( ) ) ;
125
+ schedule. add_stage ( "test" , SystemStage :: single_threaded ( ) ) ;
125
126
schedule. add_system_to_stage ( "test" , entity_labels_system. system ( ) ) ;
126
127
( world, resources, schedule)
127
128
}
@@ -139,7 +140,7 @@ mod tests {
139
140
let ( mut world, mut resources, mut schedule) = setup ( ) ;
140
141
141
142
let e1 = world. spawn ( ( holy_cow ( ) , ) ) ;
142
- schedule. initialize_and_run ( & mut world, & mut resources) ;
143
+ schedule. run ( & mut world, & mut resources) ;
143
144
144
145
let entity_labels = resources. get :: < EntityLabels > ( ) . unwrap ( ) ;
145
146
assert_eq ! ( entity_labels. get( "holy" ) , & [ e1] , "holy" ) ;
@@ -151,10 +152,10 @@ mod tests {
151
152
fn add_labels ( ) {
152
153
let ( mut world, mut resources, mut schedule) = setup ( ) ;
153
154
let e1 = world. spawn ( ( holy_cow ( ) , ) ) ;
154
- schedule. initialize_and_run ( & mut world, & mut resources) ;
155
+ schedule. run ( & mut world, & mut resources) ;
155
156
156
157
world. get_mut :: < Labels > ( e1) . unwrap ( ) . insert ( "shalau" ) ;
157
- schedule. initialize_and_run ( & mut world, & mut resources) ;
158
+ schedule. run ( & mut world, & mut resources) ;
158
159
159
160
let entity_labels = resources. get :: < EntityLabels > ( ) . unwrap ( ) ;
160
161
assert_eq ! ( entity_labels. get( "holy" ) , & [ e1] , "holy" ) ;
@@ -166,10 +167,10 @@ mod tests {
166
167
fn remove_labels ( ) {
167
168
let ( mut world, mut resources, mut schedule) = setup ( ) ;
168
169
let e1 = world. spawn ( ( holy_cow ( ) , ) ) ;
169
- schedule. initialize_and_run ( & mut world, & mut resources) ;
170
+ schedule. run ( & mut world, & mut resources) ;
170
171
171
172
world. get_mut :: < Labels > ( e1) . unwrap ( ) . remove ( "holy" ) ;
172
- schedule. initialize_and_run ( & mut world, & mut resources) ;
173
+ schedule. run ( & mut world, & mut resources) ;
173
174
174
175
let entity_labels = resources. get :: < EntityLabels > ( ) . unwrap ( ) ;
175
176
assert_eq ! ( entity_labels. get( "holy" ) , & [ ] , "holy" ) ;
@@ -181,10 +182,10 @@ mod tests {
181
182
fn removes_despawned_entity ( ) {
182
183
let ( mut world, mut resources, mut schedule) = setup ( ) ;
183
184
let e1 = world. spawn ( ( holy_cow ( ) , ) ) ;
184
- schedule. initialize_and_run ( & mut world, & mut resources) ;
185
+ schedule. run ( & mut world, & mut resources) ;
185
186
186
187
world. despawn ( e1) . unwrap ( ) ;
187
- schedule. initialize_and_run ( & mut world, & mut resources) ;
188
+ schedule. run ( & mut world, & mut resources) ;
188
189
189
190
let entity_labels = resources. get :: < EntityLabels > ( ) . unwrap ( ) ;
190
191
assert_eq ! ( entity_labels. get( "holy" ) , & [ ] , "holy" ) ;
@@ -196,10 +197,10 @@ mod tests {
196
197
fn removes_labels_when_component_removed ( ) {
197
198
let ( mut world, mut resources, mut schedule) = setup ( ) ;
198
199
let e1 = world. spawn ( ( holy_cow ( ) , ) ) ;
199
- schedule. initialize_and_run ( & mut world, & mut resources) ;
200
+ schedule. run ( & mut world, & mut resources) ;
200
201
201
202
world. remove_one :: < Labels > ( e1) . unwrap ( ) ;
202
- schedule. initialize_and_run ( & mut world, & mut resources) ;
203
+ schedule. run ( & mut world, & mut resources) ;
203
204
204
205
let entity_labels = resources. get :: < EntityLabels > ( ) . unwrap ( ) ;
205
206
assert_eq ! ( entity_labels. get( "holy" ) , & [ ] , "holy" ) ;
@@ -211,10 +212,10 @@ mod tests {
211
212
fn adds_another_spawned_entity ( ) {
212
213
let ( mut world, mut resources, mut schedule) = setup ( ) ;
213
214
let e1 = world. spawn ( ( holy_cow ( ) , ) ) ;
214
- schedule. initialize_and_run ( & mut world, & mut resources) ;
215
+ schedule. run ( & mut world, & mut resources) ;
215
216
216
217
let e2 = world. spawn ( ( holy_shamoni ( ) , ) ) ;
217
- schedule. initialize_and_run ( & mut world, & mut resources) ;
218
+ schedule. run ( & mut world, & mut resources) ;
218
219
219
220
let entity_labels = resources. get :: < EntityLabels > ( ) . unwrap ( ) ;
220
221
assert_eq ! ( entity_labels. get( "holy" ) , & [ e1, e2] , "holy" ) ;
@@ -227,13 +228,13 @@ mod tests {
227
228
fn removes_despawned_entity_but_leaves_other ( ) {
228
229
let ( mut world, mut resources, mut schedule) = setup ( ) ;
229
230
let e1 = world. spawn ( ( holy_cow ( ) , ) ) ;
230
- schedule. initialize_and_run ( & mut world, & mut resources) ;
231
+ schedule. run ( & mut world, & mut resources) ;
231
232
232
233
let e2 = world. spawn ( ( holy_shamoni ( ) , ) ) ;
233
- schedule. initialize_and_run ( & mut world, & mut resources) ;
234
+ schedule. run ( & mut world, & mut resources) ;
234
235
235
236
world. despawn ( e1) . unwrap ( ) ;
236
- schedule. initialize_and_run ( & mut world, & mut resources) ;
237
+ schedule. run ( & mut world, & mut resources) ;
237
238
238
239
let entity_labels = resources. get :: < EntityLabels > ( ) . unwrap ( ) ;
239
240
assert_eq ! ( entity_labels. get( "holy" ) , & [ e2] , "holy" ) ;
0 commit comments