From d2614f2d802d0fb8000821a81553b600cc85f734 Mon Sep 17 00:00:00 2001 From: Nicola Papale Date: Wed, 6 Dec 2023 21:35:46 +0100 Subject: [PATCH] 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. --- crates/bevy_ecs/src/system/mod.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/crates/bevy_ecs/src/system/mod.rs b/crates/bevy_ecs/src/system/mod.rs index 4bd91ea692a76..cebadc6f3220b 100644 --- a/crates/bevy_ecs/src/system/mod.rs +++ b/crates/bevy_ecs/src/system/mod.rs @@ -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>>) { + unimplemented!() + } + + fn exclusive_with_state( + _: &mut World, + _: Local, + _: (&mut QueryState<&W>, &mut SystemState>>), + _: (), + ) { + unimplemented!() + } + fn not(In(val): In) -> bool { !val } @@ -1609,7 +1622,9 @@ mod tests { assert_is_system(returning::>.map(Result::unwrap)); assert_is_system(returning::>.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::.pipe(exclusive_in_out::)); returning::<()>.run_if(returning::.pipe(not));