-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add compile fail tests for custom where
- Loading branch information
Showing
3 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
crates/bevy_reflect_compile_fail_tests/tests/reflect_derive/custom_where.fail.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
use bevy_reflect::Reflect; | ||
use std::marker::PhantomData; | ||
|
||
#[derive(Clone)] | ||
struct ReflectMyTrait; | ||
|
||
#[derive(Reflect)] | ||
#[reflect(MyTrait, where)] | ||
pub struct Foo<T> { | ||
value: String, | ||
_marker: PhantomData<T>, | ||
} | ||
|
||
#[derive(Reflect)] | ||
#[reflect(where, MyTrait)] | ||
pub struct Bar<T> { | ||
value: String, | ||
_marker: PhantomData<T>, | ||
} | ||
|
||
fn main() {} |
11 changes: 11 additions & 0 deletions
11
crates/bevy_reflect_compile_fail_tests/tests/reflect_derive/custom_where.fail.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
error: expected identifier, found keyword `where` | ||
--> tests/reflect_derive/custom_where.fail.rs:8:20 | ||
| | ||
8 | #[reflect(MyTrait, where)] | ||
| ^^^^^ | ||
|
||
error: unexpected token | ||
--> tests/reflect_derive/custom_where.fail.rs:15:16 | ||
| | ||
15 | #[reflect(where, MyTrait)] | ||
| ^ |
23 changes: 23 additions & 0 deletions
23
crates/bevy_reflect_compile_fail_tests/tests/reflect_derive/custom_where.pass.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
use bevy_reflect::Reflect; | ||
use std::marker::PhantomData; | ||
|
||
#[derive(Clone)] | ||
struct ReflectMyTrait; | ||
|
||
#[derive(Reflect)] | ||
#[reflect(MyTrait)] | ||
#[reflect(where)] | ||
pub struct Foo<T> { | ||
value: String, | ||
_marker: PhantomData<T>, | ||
} | ||
|
||
#[derive(Reflect)] | ||
#[reflect(where)] | ||
#[reflect(MyTrait)] | ||
pub struct Bar<T> { | ||
value: String, | ||
_marker: PhantomData<T>, | ||
} | ||
|
||
fn main() {} |