Skip to content

Commit 2a798bc

Browse files
More tests
1 parent 83d6239 commit 2a798bc

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

crates/bevy_ecs/src/schedule/ambiguity_detection.rs

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,64 @@ mod tests {
352352
pub(super) fn system_f(_res: ResMut<TestResource>) {}
353353
}
354354

355+
#[test]
356+
fn trivial_ambiguity() {
357+
let mut world = World::new();
358+
let mut test_stage = SystemStage::parallel();
359+
test_stage.add_system(system_a).add_system(system_b);
360+
361+
test_stage.initialize(&mut world);
362+
assert_eq!(
363+
test_stage.n_ambiguities(ReportExecutionOrderAmbiguities::Minimal),
364+
1
365+
);
366+
}
367+
368+
#[test]
369+
fn ignore_all_ambiguities() {
370+
let mut world = World::new();
371+
let mut test_stage = SystemStage::parallel();
372+
test_stage
373+
.add_system(system_a.ignore_all_ambiguities())
374+
.add_system(system_b);
375+
376+
test_stage.initialize(&mut world);
377+
assert_eq!(
378+
test_stage.n_ambiguities(ReportExecutionOrderAmbiguities::Minimal),
379+
0
380+
);
381+
}
382+
383+
#[test]
384+
fn ambiguous_with_label() {
385+
let mut world = World::new();
386+
let mut test_stage = SystemStage::parallel();
387+
test_stage
388+
.add_system(system_a.ambiguous_with("b"))
389+
.add_system(system_b.label("b"));
390+
391+
test_stage.initialize(&mut world);
392+
assert_eq!(
393+
test_stage.n_ambiguities(ReportExecutionOrderAmbiguities::Minimal),
394+
0
395+
);
396+
}
397+
398+
#[test]
399+
fn ambiguous_with_system() {
400+
let mut world = World::new();
401+
let mut test_stage = SystemStage::parallel();
402+
test_stage
403+
.add_system(system_a.ambiguous_with(system_b))
404+
.add_system(system_b);
405+
406+
test_stage.initialize(&mut world);
407+
assert_eq!(
408+
test_stage.n_ambiguities(ReportExecutionOrderAmbiguities::Minimal),
409+
0
410+
);
411+
}
412+
355413
#[test]
356414
fn off() {
357415
let test_stage = make_test_stage();

0 commit comments

Comments
 (0)