mirror of
https://github.com/bevyengine/bevy
synced 2025-02-16 14:08:32 +00:00
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.
This commit is contained in:
parent
1f97717a3d
commit
d2614f2d80
1 changed files with 16 additions and 1 deletions
|
@ -330,7 +330,7 @@ mod tests {
|
|||
},
|
||||
system::{
|
||||
Commands, In, IntoSystem, Local, NonSend, NonSendMut, ParamSet, Query, Res, ResMut,
|
||||
Resource, System, SystemState,
|
||||
Resource, StaticSystemParam, System, SystemState,
|
||||
},
|
||||
world::{FromWorld, World},
|
||||
};
|
||||
|
@ -1602,6 +1602,19 @@ mod tests {
|
|||
unimplemented!()
|
||||
}
|
||||
|
||||
fn static_system_param(_: StaticSystemParam<Query<'static, 'static, &W<u32>>>) {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn exclusive_with_state(
|
||||
_: &mut World,
|
||||
_: Local<bool>,
|
||||
_: (&mut QueryState<&W<i32>>, &mut SystemState<Query<&W<u32>>>),
|
||||
_: (),
|
||||
) {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn not(In(val): In<bool>) -> bool {
|
||||
!val
|
||||
}
|
||||
|
@ -1609,7 +1622,9 @@ mod tests {
|
|||
assert_is_system(returning::<Result<u32, std::io::Error>>.map(Result::unwrap));
|
||||
assert_is_system(returning::<Option<()>>.map(drop));
|
||||
assert_is_system(returning::<&str>.map(u64::from_str).map(Result::unwrap));
|
||||
assert_is_system(static_system_param);
|
||||
assert_is_system(exclusive_in_out::<(), Result<(), std::io::Error>>.map(bevy_utils::error));
|
||||
assert_is_system(exclusive_with_state);
|
||||
assert_is_system(returning::<bool>.pipe(exclusive_in_out::<bool, ()>));
|
||||
|
||||
returning::<()>.run_if(returning::<bool>.pipe(not));
|
||||
|
|
Loading…
Add table
Reference in a new issue