mirror of
https://github.com/tokio-rs/tokio.git
synced 2025-09-28 12:10:37 +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
14 lines
266 B
Rust
14 lines
266 B
Rust
use tests_build::tokio;
|
|
|
|
fn main() {}
|
|
|
|
// arguments and output type is forwarded so other macros can access them
|
|
|
|
#[tokio::test]
|
|
async fn test_fn_has_args(_x: u8) {}
|
|
|
|
#[tokio::test]
|
|
async fn test_has_output() -> Result<(), Box<dyn std::error::Error>> {
|
|
Ok(())
|
|
}
|