Skip to content

Commit

Permalink
Add context to compile tests (bevyengine#7342)
Browse files Browse the repository at this point in the history
# Objective

`bevy_ecs/system_param.rs` contains many seemingly-arbitrary struct definitions which serve as compile tests.

## Solution

Add a comment to each one, linking the issue or PR that motivated its addition.
  • Loading branch information
JoJoJet authored and ItsDoot committed Feb 1, 2023
1 parent 0174dd3 commit 7fc02b6
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion crates/bevy_ecs/src/system/system_param.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1481,7 +1481,7 @@ mod tests {
system::Query,
};

// Compile test for #2838
// Compile test for https://github.com/bevyengine/bevy/pull/2838.
#[derive(SystemParam)]
pub struct SpecialQuery<
'w,
Expand All @@ -1492,6 +1492,8 @@ mod tests {
_query: Query<'w, 's, Q, F>,
}

// Compile tests for https://github.com/bevyengine/bevy/pull/6694.

#[derive(SystemParam)]
pub struct SpecialRes<'w, T: Resource> {
_res: Res<'w, T>,
Expand All @@ -1505,9 +1507,11 @@ mod tests {
#[derive(Resource)]
pub struct R<const I: usize>;

// Compile test for https://github.com/bevyengine/bevy/pull/7001.
#[derive(SystemParam)]
pub struct ConstGenericParam<'w, const I: usize>(Res<'w, R<I>>);

// Compile test for https://github.com/bevyengine/bevy/pull/6867.
#[derive(SystemParam)]
pub struct LongParam<'w> {
_r0: Res<'w, R<0>>,
Expand All @@ -1534,13 +1538,16 @@ mod tests {
crate::system::assert_is_system(long_system);
}

// Compile test for https://github.com/bevyengine/bevy/pull/6919.
#[derive(SystemParam)]
struct MyParam<'w, T: Resource, Marker: 'static> {
_foo: Res<'w, T>,
#[system_param(ignore)]
marker: PhantomData<Marker>,
}

// Compile tests for https://github.com/bevyengine/bevy/pull/6957.

#[derive(SystemParam)]
pub struct UnitParam;

Expand All @@ -1553,6 +1560,7 @@ mod tests {
#[derive(Resource)]
struct PrivateResource;

// Regression test for https://github.com/bevyengine/bevy/issues/4200.
#[derive(SystemParam)]
pub struct EncapsulatedParam<'w>(Res<'w, PrivateResource>);

Expand Down

0 comments on commit 7fc02b6

Please sign in to comment.