task: use #[tokio::test] explicitly in tests/task_builder.rs (#7698)

This commit is contained in:
Alice Ryhl
2025-10-20 11:15:04 +00:00
committed by GitHub
parent d060401f6c
commit acfdb87e2b
+7 -10
View File
@@ -1,12 +1,9 @@
#![cfg(all(tokio_unstable, feature = "tracing"))] #![cfg(all(tokio_unstable, feature = "tracing"))]
use std::rc::Rc; use std::rc::Rc;
use tokio::{ use tokio::task::{Builder, LocalSet};
task::{Builder, LocalSet},
test,
};
#[test] #[tokio::test]
async fn spawn_with_name() { async fn spawn_with_name() {
let result = Builder::new() let result = Builder::new()
.name("name") .name("name")
@@ -17,7 +14,7 @@ async fn spawn_with_name() {
assert_eq!(result.unwrap(), "task executed"); assert_eq!(result.unwrap(), "task executed");
} }
#[test] #[tokio::test]
async fn spawn_blocking_with_name() { async fn spawn_blocking_with_name() {
let result = Builder::new() let result = Builder::new()
.name("name") .name("name")
@@ -28,7 +25,7 @@ async fn spawn_blocking_with_name() {
assert_eq!(result.unwrap(), "task executed"); assert_eq!(result.unwrap(), "task executed");
} }
#[test] #[tokio::test]
async fn spawn_local_with_name() { async fn spawn_local_with_name() {
let unsend_data = Rc::new("task executed"); let unsend_data = Rc::new("task executed");
let result = LocalSet::new() let result = LocalSet::new()
@@ -44,7 +41,7 @@ async fn spawn_local_with_name() {
assert_eq!(*result.unwrap(), "task executed"); assert_eq!(*result.unwrap(), "task executed");
} }
#[test] #[tokio::test]
async fn spawn_without_name() { async fn spawn_without_name() {
let result = Builder::new() let result = Builder::new()
.spawn(async { "task executed" }) .spawn(async { "task executed" })
@@ -54,7 +51,7 @@ async fn spawn_without_name() {
assert_eq!(result.unwrap(), "task executed"); assert_eq!(result.unwrap(), "task executed");
} }
#[test] #[tokio::test]
async fn spawn_blocking_without_name() { async fn spawn_blocking_without_name() {
let result = Builder::new() let result = Builder::new()
.spawn_blocking(|| "task executed") .spawn_blocking(|| "task executed")
@@ -64,7 +61,7 @@ async fn spawn_blocking_without_name() {
assert_eq!(result.unwrap(), "task executed"); assert_eq!(result.unwrap(), "task executed");
} }
#[test] #[tokio::test]
async fn spawn_local_without_name() { async fn spawn_local_without_name() {
let unsend_data = Rc::new("task executed"); let unsend_data = Rc::new("task executed");
let result = LocalSet::new() let result = LocalSet::new()