Skip to content

Commit

Permalink
Fixed broken tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alice-i-cecile committed Jul 2, 2021
1 parent eb9ad8d commit 436dbd1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
5 changes: 3 additions & 2 deletions crates/bevy_ecs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ pub mod prelude {
Schedule, Stage, StageLabel, State, SystemLabel, SystemSet, SystemStage,
},
system::{
Commands, ConfigurableSystem, In, IntoChainSystem, IntoExclusiveSystem, IntoSystem,
Local, NonSend, NonSendMut, Query, QuerySet, RemovedComponents, Res, ResMut, System,
Commands, ConfigurableSystem, ExclusiveSystem, In, IntoChainSystem,
IntoExclusiveSystem, IntoSystem, Local, NonSend, NonSendMut, Query, QuerySet,
RemovedComponents, Res, ResMut, System,
},
world::{FromWorld, Mut, World},
};
Expand Down
7 changes: 6 additions & 1 deletion crates/bevy_ecs/src/system/exclusive_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub trait ExclusiveSystem: Send + Sync + 'static {
/// }
///
/// world.insert_resource::<Counter>(Counter(0));
/// count_up.exclusive_system().run_direct(world);
/// count_up.exclusive_system().run_direct(&mut world);
/// let counter = world.get_resource::<Counter>().unwrap();
/// assert_eq!(counter.0, 1);
///```
Expand Down Expand Up @@ -77,6 +77,11 @@ impl ExclusiveSystem for ExclusiveSystemFn {
world.last_change_tick = saved_last_tick;
}

fn run_direct(&mut self, world: &mut World) {
self.initialize(world);
self.run(world);
}

fn initialize(&mut self, _: &mut World) {}

fn check_change_tick(&mut self, change_tick: u32) {
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_ecs/src/system/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ pub trait System: Send + Sync + 'static {
/// }
///
/// world.insert_resource::<Counter>(Counter(0));
/// count_up.run_direct((), world);
/// count_up.system().run_direct((), &mut world);
/// let counter = world.get_resource::<Counter>().unwrap();
/// assert_eq!(counter.0, 1);
/// ```
Expand Down

0 comments on commit 436dbd1

Please sign in to comment.