mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-27 00:00:12 +02:00
task: use #[tokio::test] explicitly in tests/task_builder.rs (#7698)
This commit is contained in:
@@ -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()
|
||||||
|
|||||||
Reference in New Issue
Block a user