-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
108 additions
and
38 deletions.
There are no files selected for viewing
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
4 changes: 2 additions & 2 deletions
4
packages/yew-router-macro/tests/routable_derive/bad-ats-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
28 changes: 18 additions & 10 deletions
28
packages/yew-router-macro/tests/routable_derive/bad-ats-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 |
---|---|---|
@@ -1,12 +1,20 @@ | ||
error: at attribute must be present on every variant | ||
--> $DIR/bad-ats-fail.rs:3:5 | ||
error: at attribute not found | ||
--> $DIR/bad-ats-fail.rs:1:10 | ||
| | ||
3 | One, | ||
| ^^^ | ||
|
||
error: only one at attribute must be present | ||
--> $DIR/bad-ats-fail.rs:8:5 | ||
1 | #[derive(yew_router::Routable)] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
8 | / #[at("/one")] | ||
9 | | #[at("/two")] | ||
| |_________________^ | ||
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error[E0277]: the trait bound `RoutesTwo: Clone` is not satisfied | ||
--> $DIR/bad-ats-fail.rs:6:10 | ||
| | ||
6 | #[derive(yew_router::Routable)] | ||
| ^^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `RoutesTwo` | ||
| | ||
::: $WORKSPACE/packages/yew-router/src/routable.rs | ||
| | ||
| pub trait Routable: Sized + Clone { | ||
| ----- required by this bound in `Routable` | ||
| | ||
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) |
11 changes: 11 additions & 0 deletions
11
packages/yew-router-macro/tests/routable_derive/invalid-bind-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,11 @@ | ||
#[derive(Debug, Clone, PartialEq, yew_router::Routable)] | ||
enum Routes { | ||
#[at("/")] | ||
Home { | ||
#[bind(query)] | ||
#[bind(query)] | ||
id: u32 | ||
}, | ||
} | ||
|
||
fn main() {} |
6 changes: 6 additions & 0 deletions
6
packages/yew-router-macro/tests/routable_derive/invalid-bind-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,6 @@ | ||
error: a field can have only one `#[bind(...)]` | ||
--> $DIR/invalid-bind-fail.rs:5:9 | ||
| | ||
5 | / #[bind(query)] | ||
6 | | #[bind(query)] | ||
| |______________________^ |
12 changes: 6 additions & 6 deletions
12
packages/yew-router-macro/tests/routable_derive/invalid-not-found-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 |
---|---|---|
@@ -1,18 +1,18 @@ | ||
#[derive(Debug, PartialEq, yew_router::Routable)] | ||
#[derive(Clone, Debug, PartialEq, yew_router::Routable)] | ||
enum RoutesOne { | ||
#[at("/")] | ||
#[not_found] | ||
#[bind(not_found)] | ||
Home, | ||
#[at("/404")] | ||
#[not_found] | ||
#[bind(not_found)] | ||
NotFound, | ||
} | ||
|
||
#[derive(Debug, PartialEq, yew_router::Routable)] | ||
#[derive(Clone, Debug, PartialEq, yew_router::Routable)] | ||
enum RoutesTwo { | ||
#[at("/404")] | ||
#[not_found] | ||
#[not_found] | ||
#[bind(not_found)] | ||
#[bind(not_found)] | ||
NotFound, | ||
} | ||
fn main() {} |
30 changes: 17 additions & 13 deletions
30
packages/yew-router-macro/tests/routable_derive/invalid-not-found-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 |
---|---|---|
@@ -1,15 +1,19 @@ | ||
error: there can only be one not_found | ||
--> $DIR/invalid-not-found-fail.rs:4:5 | ||
| | ||
4 | / #[not_found] | ||
5 | | Home, | ||
6 | | #[at("/404")] | ||
7 | | #[not_found] | ||
| |________________^ | ||
|
||
error: there can only be one not_found | ||
error: only one `#[bind(not_found)]` can be present | ||
--> $DIR/invalid-not-found-fail.rs:14:5 | ||
| | ||
14 | / #[not_found] | ||
15 | | #[not_found] | ||
| |________________^ | ||
14 | / #[bind(not_found)] | ||
15 | | #[bind(not_found)] | ||
| |______________________^ | ||
|
||
error[E0277]: the trait bound `RoutesOne: Clone` is not satisfied | ||
--> $DIR/invalid-not-found-fail.rs:1:28 | ||
| | ||
1 | #[derive(Debug, PartialEq, yew_router::Routable)] | ||
| ^^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `RoutesOne` | ||
| | ||
::: $WORKSPACE/packages/yew-router/src/routable.rs | ||
| | ||
| pub trait Routable: Sized + Clone { | ||
| ----- required by this bound in `Routable` | ||
| | ||
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) |
18 changes: 18 additions & 0 deletions
18
packages/yew-router-macro/tests/routable_derive/no-clone-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,18 @@ | ||
#![no_implicit_prelude] | ||
|
||
#[derive(::yew_router::Routable)] | ||
enum Routes { | ||
#[at("/")] | ||
One, | ||
#[at("/two/:id")] | ||
Two { | ||
id: u32, | ||
#[bind(query)] | ||
query: u32, | ||
}, | ||
#[at("/404")] | ||
#[bind(not_found)] | ||
NotFound, | ||
} | ||
|
||
fn main() {} |
12 changes: 12 additions & 0 deletions
12
packages/yew-router-macro/tests/routable_derive/no-clone-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,12 @@ | ||
error[E0277]: the trait bound `Routes: Clone` is not satisfied | ||
--> $DIR/no-clone-fail.rs:3:10 | ||
| | ||
3 | #[derive(::yew_router::Routable)] | ||
| ^^^^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `Routes` | ||
| | ||
::: $WORKSPACE/packages/yew-router/src/routable.rs | ||
| | ||
| pub trait Routable: Sized + Clone { | ||
| ----- required by this bound in `Routable` | ||
| | ||
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) |
2 changes: 1 addition & 1 deletion
2
packages/yew-router-macro/tests/routable_derive/unnamed-fields-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
2 changes: 1 addition & 1 deletion
2
packages/yew-router-macro/tests/routable_derive/unnamed-fields-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
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
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
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