Skip to content

Commit d2614f2

Browse files
authored
Add a couple assertions for system types (#10893)
# Objective Test more complex function signatures for exclusive systems, and test that `StaticSystemParam` is indeed a `SystemParam`. I mean, it currently works, but might as well add a test for it.
1 parent 1f97717 commit d2614f2

File tree

1 file changed

+16
-1
lines changed
  • crates/bevy_ecs/src/system

1 file changed

+16
-1
lines changed

crates/bevy_ecs/src/system/mod.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ mod tests {
330330
},
331331
system::{
332332
Commands, In, IntoSystem, Local, NonSend, NonSendMut, ParamSet, Query, Res, ResMut,
333-
Resource, System, SystemState,
333+
Resource, StaticSystemParam, System, SystemState,
334334
},
335335
world::{FromWorld, World},
336336
};
@@ -1602,14 +1602,29 @@ mod tests {
16021602
unimplemented!()
16031603
}
16041604

1605+
fn static_system_param(_: StaticSystemParam<Query<'static, 'static, &W<u32>>>) {
1606+
unimplemented!()
1607+
}
1608+
1609+
fn exclusive_with_state(
1610+
_: &mut World,
1611+
_: Local<bool>,
1612+
_: (&mut QueryState<&W<i32>>, &mut SystemState<Query<&W<u32>>>),
1613+
_: (),
1614+
) {
1615+
unimplemented!()
1616+
}
1617+
16051618
fn not(In(val): In<bool>) -> bool {
16061619
!val
16071620
}
16081621

16091622
assert_is_system(returning::<Result<u32, std::io::Error>>.map(Result::unwrap));
16101623
assert_is_system(returning::<Option<()>>.map(drop));
16111624
assert_is_system(returning::<&str>.map(u64::from_str).map(Result::unwrap));
1625+
assert_is_system(static_system_param);
16121626
assert_is_system(exclusive_in_out::<(), Result<(), std::io::Error>>.map(bevy_utils::error));
1627+
assert_is_system(exclusive_with_state);
16131628
assert_is_system(returning::<bool>.pipe(exclusive_in_out::<bool, ()>));
16141629

16151630
returning::<()>.run_if(returning::<bool>.pipe(not));

0 commit comments

Comments
 (0)