mirror of
https://github.com/tokio-rs/tokio.git
synced 2025-09-25 12:00:35 +00:00

Fixes #2388 Previously `#[tokio::test]` would error on functions that took arguments. That meant other attribute macros couldn't do further transformations on them. This changes that so arguments are forwarded as is. Whatever else might be included on the function is forwarded as well. For example return type, generics, etc. Worth noting that this is only for compatibility with other macros. `#[test]`s that take arguments will still fail to compile. A bit odd that [trybuild] tests don't fail `#[test]` functions with arguments which is why the new tests are run with `t.pass(...)`. They do actually fail if part of a real crate. [trybuild]: https://crates.io/crates/trybuild
72 lines
2.3 KiB
Plaintext
72 lines
2.3 KiB
Plaintext
error: the `async` keyword is missing from the function declaration
|
|
--> $DIR/macros_invalid_input.rs:4:1
|
|
|
|
|
4 | fn main_is_not_async() {}
|
|
| ^^
|
|
|
|
error: Unknown attribute foo is specified; expected one of: `flavor`, `worker_threads`, `start_paused`
|
|
--> $DIR/macros_invalid_input.rs:6:15
|
|
|
|
|
6 | #[tokio::main(foo)]
|
|
| ^^^
|
|
|
|
error: Must have specified ident
|
|
--> $DIR/macros_invalid_input.rs:9:15
|
|
|
|
|
9 | #[tokio::main(threadpool::bar)]
|
|
| ^^^^^^^^^^^^^^^
|
|
|
|
error: the `async` keyword is missing from the function declaration
|
|
--> $DIR/macros_invalid_input.rs:13:1
|
|
|
|
|
13 | fn test_is_not_async() {}
|
|
| ^^
|
|
|
|
error: Unknown attribute foo is specified; expected one of: `flavor`, `worker_threads`, `start_paused`
|
|
--> $DIR/macros_invalid_input.rs:15:15
|
|
|
|
|
15 | #[tokio::test(foo)]
|
|
| ^^^
|
|
|
|
error: Unknown attribute foo is specified; expected one of: `flavor`, `worker_threads`, `start_paused`
|
|
--> $DIR/macros_invalid_input.rs:18:15
|
|
|
|
|
18 | #[tokio::test(foo = 123)]
|
|
| ^^^^^^^^^
|
|
|
|
error: Failed to parse value of `flavor` as string.
|
|
--> $DIR/macros_invalid_input.rs:21:24
|
|
|
|
|
21 | #[tokio::test(flavor = 123)]
|
|
| ^^^
|
|
|
|
error: No such runtime flavor `foo`. The runtime flavors are `current_thread` and `multi_thread`.
|
|
--> $DIR/macros_invalid_input.rs:24:24
|
|
|
|
|
24 | #[tokio::test(flavor = "foo")]
|
|
| ^^^^^
|
|
|
|
error: The `start_paused` option requires the `current_thread` runtime flavor. Use `#[tokio::test(flavor = "current_thread")]`
|
|
--> $DIR/macros_invalid_input.rs:27:55
|
|
|
|
|
27 | #[tokio::test(flavor = "multi_thread", start_paused = false)]
|
|
| ^^^^^
|
|
|
|
error: Failed to parse value of `worker_threads` as integer.
|
|
--> $DIR/macros_invalid_input.rs:30:57
|
|
|
|
|
30 | #[tokio::test(flavor = "multi_thread", worker_threads = "foo")]
|
|
| ^^^^^
|
|
|
|
error: The `worker_threads` option requires the `multi_thread` runtime flavor. Use `#[tokio::test(flavor = "multi_thread")]`
|
|
--> $DIR/macros_invalid_input.rs:33:59
|
|
|
|
|
33 | #[tokio::test(flavor = "current_thread", worker_threads = 4)]
|
|
| ^
|
|
|
|
error: second test attribute is supplied
|
|
--> $DIR/macros_invalid_input.rs:37:1
|
|
|
|
|
37 | #[test]
|
|
| ^^^^^^^
|