forked from tokio-rs/tokio
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
macros: disambiguate the built-in #[test] attribute in macro expansion (
tokio-rs#2503) `tokio::test` and related macros now use the absolute path `::core::prelude::v1::test` to refer to the built-in `test` macro. This absolute path was introduced in rust-lang/rust#62086.
- Loading branch information
Showing
2 changed files
with
22 additions
and
3 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
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,19 @@ | ||
use tokio::test; | ||
|
||
#[test] | ||
async fn test_macro_can_be_used_via_use() { | ||
tokio::spawn(async { | ||
assert_eq!(1 + 1, 2); | ||
}) | ||
.await | ||
.unwrap(); | ||
} | ||
|
||
#[tokio::test] | ||
async fn test_macro_is_resilient_to_shadowing() { | ||
tokio::spawn(async { | ||
assert_eq!(1 + 1, 2); | ||
}) | ||
.await | ||
.unwrap(); | ||
} |