mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-25 00:00:18 +02:00
The "global executor" thread-local is to track where to spawn new tasks, **not** which scheduler is active on the current thread. This fixes a bug with scheduling tasks on the basic_scheduler by tracking the currently active basic_scheduler with a dedicated thread-local variable. Fixes: #1851
21 lines
420 B
Rust
21 lines
420 B
Rust
#![warn(rust_2018_idioms)]
|
|
#![cfg(feature = "full")]
|
|
|
|
use tokio::fs;
|
|
use tokio_test::assert_ok;
|
|
|
|
#[tokio::test]
|
|
async fn path_read_write() {
|
|
let temp = tempdir();
|
|
let dir = temp.path();
|
|
|
|
assert_ok!(fs::write(dir.join("bar"), b"bytes").await);
|
|
let out = assert_ok!(fs::read(dir.join("bar")).await);
|
|
|
|
assert_eq!(out, b"bytes");
|
|
}
|
|
|
|
fn tempdir() -> tempfile::TempDir {
|
|
tempfile::tempdir().unwrap()
|
|
}
|