repo stringlengths 6 65 | file_url stringlengths 81 311 | file_path stringlengths 6 227 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:31:58 2026-01-04 20:25:31 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/macros_pin.rs | tokio/tests/macros_pin.rs | #![cfg(feature = "macros")]
#[cfg(all(target_family = "wasm", not(target_os = "wasi")))]
use wasm_bindgen_test::wasm_bindgen_test as maybe_tokio_test;
#[cfg(not(all(target_family = "wasm", not(target_os = "wasi"))))]
use tokio::test as maybe_tokio_test;
async fn one() {}
async fn two() {}
#[maybe_tokio_test]
async ... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/io_lines.rs | tokio/tests/io_lines.rs | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use tokio::io::AsyncBufReadExt;
use tokio_test::assert_ok;
#[tokio::test]
async fn lines_inherent() {
let rd: &[u8] = b"hello\r\nworld\n\n";
let mut st = rd.lines();
let b = assert_ok!(st.next_line().await).unwrap();
assert_eq!(b, "hello");
let... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/fs_file.rs | tokio/tests/fs_file.rs | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))] // WASI does not support all fs operations
use futures::future::FutureExt;
use std::io::prelude::*;
use std::io::IoSlice;
use tempfile::NamedTempFile;
use tokio::fs::File;
use tokio::io::{AsyncReadExt, AsyncSeekExt, AsyncWriteExt, SeekF... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/io_repeat.rs | tokio/tests/io_repeat.rs | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(miri)))]
use tokio::io::AsyncReadExt;
#[tokio::test]
async fn repeat_poll_read_is_cooperative() {
tokio::select! {
biased;
_ = async {
loop {
let mut buf = [0u8; 4096];
tokio::io::repeat(0b101).... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/signal_realtime.rs | tokio/tests/signal_realtime.rs | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(any(target_os = "linux", target_os = "illumos"))]
#![cfg(not(miri))] // No `sigaction` in Miri.
mod support {
pub mod signal;
}
use libc::c_int;
use support::signal::send_signal;
use futures::stream::{FuturesUnordered, StreamExt};
use std::collections::... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/sync_notify_owned.rs | tokio/tests/sync_notify_owned.rs | #![warn(rust_2018_idioms)]
#![cfg(feature = "sync")]
#[cfg(all(target_family = "wasm", not(target_os = "wasi")))]
use wasm_bindgen_test::wasm_bindgen_test as test;
use std::sync::Arc;
use tokio::sync::Notify;
use tokio_test::task::spawn;
use tokio_test::*;
#[allow(unused)]
trait AssertSend: Send + Sync {}
impl Asser... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/sync_semaphore_owned.rs | tokio/tests/sync_semaphore_owned.rs | #![cfg(feature = "sync")]
#[cfg(all(target_family = "wasm", not(target_os = "wasi")))]
use wasm_bindgen_test::wasm_bindgen_test as test;
use std::sync::Arc;
use tokio::sync::Semaphore;
#[test]
fn try_acquire() {
let sem = Arc::new(Semaphore::new(1));
{
let p1 = sem.clone().try_acquire_owned();
... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/io_mem_stream.rs | tokio/tests/io_mem_stream.rs | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use tokio::io::{duplex, AsyncReadExt, AsyncWriteExt};
#[tokio::test]
async fn ping_pong() {
let (mut a, mut b) = duplex(32);
let mut buf = [0u8; 4];
a.write_all(b"ping").await.unwrap();
b.read_exact(&mut buf).await.unwrap();
assert_eq!(&buf, b... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/process_issue_7144.rs | tokio/tests/process_issue_7144.rs | #![cfg(feature = "process")]
#![warn(rust_2018_idioms)]
#![cfg(target_os = "linux")]
#![cfg(not(miri))]
use tokio::process::Command;
use tokio::time::{sleep, Duration};
#[tokio::test]
async fn issue_7144() {
let mut threads = vec![];
for _ in 0..20 {
threads.push(tokio::spawn(test_one()));
}
f... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/io_read_buf.rs | tokio/tests/io_read_buf.rs | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use tokio::io::{AsyncRead, AsyncReadExt, ReadBuf};
use tokio_test::assert_ok;
use std::io;
use std::pin::Pin;
use std::task::{Context, Poll};
#[tokio::test]
async fn read_buf() {
struct Rd {
cnt: usize,
}
impl AsyncRead for Rd {
fn pol... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/fs.rs | tokio/tests/fs.rs | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi does not support file operations
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").aw... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/process_issue_42.rs | tokio/tests/process_issue_42.rs | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(unix)]
#![cfg(not(miri))]
use futures::future::join_all;
use std::process::Stdio;
use tokio::process::Command;
use tokio::task;
#[tokio::test]
async fn issue_42() {
// We spawn a many batches of processes which should exit at roughly the
// same time... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/task_local_set.rs | tokio/tests/task_local_set.rs | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use futures::{
future::{pending, ready},
FutureExt,
};
use tokio::runtime;
use tokio::sync::{mpsc, oneshot};
use tokio::task::{self, LocalSet};
use tokio::time;
#[cfg(not(target_os = "wasi"))]
use std::cell::Cell;
use std::sync::atomic::AtomicBool;
#[cfg(n... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/io_driver.rs | tokio/tests/io_driver.rs | #![warn(rust_2018_idioms)]
// Wasi does not support panic recovery or threading
#![cfg(all(feature = "full", not(target_os = "wasi")))]
use tokio::net::TcpListener;
use tokio::runtime;
use tokio_test::{assert_ok, assert_pending};
use futures::task::{waker_ref, ArcWake};
use std::future::Future;
use std::net::TcpStrea... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/io_async_fd.rs | tokio/tests/io_async_fd.rs | #![warn(rust_2018_idioms)]
#![cfg(all(unix, feature = "full"))]
use std::os::unix::io::{AsRawFd, RawFd};
use std::sync::{
atomic::{AtomicBool, Ordering},
Arc,
};
use std::time::Duration;
use std::{
future::Future,
io::{self, ErrorKind, Read, Write},
task::{Context, Waker},
};
use nix::unistd::{rea... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/fs_open_options_windows.rs | tokio/tests/fs_open_options_windows.rs | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))] // WASI does not support all fs operations
#![cfg(windows)]
use tokio::fs::OpenOptions;
use windows_sys::Win32::Storage::FileSystem;
#[tokio::test]
#[cfg(windows)]
async fn open_options_windows_access_mode() {
// TESTING HACK: use ... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/sync_broadcast.rs | tokio/tests/sync_broadcast.rs | #![allow(clippy::cognitive_complexity)]
#![warn(rust_2018_idioms)]
#![cfg(feature = "sync")]
#[cfg(all(target_family = "wasm", not(target_os = "wasi")))]
use wasm_bindgen_test::wasm_bindgen_test as test;
use tokio::sync::broadcast;
use tokio_test::task;
use tokio_test::{
assert_err, assert_ok, assert_pending, ass... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/time_panic.rs | tokio/tests/time_panic.rs | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi doesn't support panic recovery
#![cfg(panic = "unwind")]
use futures::future;
use std::error::Error;
use std::time::Duration;
use tokio::runtime::{Builder, Runtime};
use tokio::time::{self, interval, interval_at, timeout, Instan... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/time_sleep.rs | tokio/tests/time_sleep.rs | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(not(miri))] // Too slow on Miri.
use std::future::Future;
use std::task::Context;
use futures::task::noop_waker_ref;
use tokio::time::{self, Duration, Instant};
use tokio_test::{assert_elapsed, assert_pending, assert_ready, task};
#[tokio::test]
async fn i... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/fs_uring.rs | tokio/tests/fs_uring.rs | //! Uring file operations tests.
#![cfg(all(
tokio_unstable,
feature = "io-uring",
feature = "rt",
feature = "fs",
target_os = "linux"
))]
use futures::future::FutureExt;
use std::sync::mpsc;
use std::task::Poll;
use std::time::Duration;
use std::{future::poll_fn, path::PathBuf};
use tempfile::Nam... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/rt_unstable_metrics.rs | tokio/tests/rt_unstable_metrics.rs | #![warn(rust_2018_idioms)]
#![cfg(all(
feature = "full",
tokio_unstable,
not(target_os = "wasi"),
target_has_atomic = "64"
))]
use std::future::Future;
use std::sync::{mpsc, Arc, Mutex};
use std::task::Poll;
use std::thread;
use tokio::macros::support::poll_fn;
use tokio::runtime::{HistogramConfigurat... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/io_copy_bidirectional.rs | tokio/tests/io_copy_bidirectional.rs | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi does not support bind()
use std::time::Duration;
use tokio::io::{self, copy_bidirectional, AsyncReadExt, AsyncWriteExt};
use tokio::net::TcpStream;
use tokio::task::JoinHandle;
async fn make_socketpair() -> (TcpStream, TcpStrea... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/task_yield_now.rs | tokio/tests/task_yield_now.rs | #![cfg(all(feature = "full", not(target_os = "wasi"), tokio_unstable))]
use tokio::task;
use tokio_test::task::spawn;
// `yield_now` is tested within the runtime in `rt_common`.
#[test]
fn yield_now_outside_of_runtime() {
let mut task = spawn(async {
task::yield_now().await;
});
assert!(task.poll... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/process_raw_handle.rs | tokio/tests/process_raw_handle.rs | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(windows)]
#![cfg(not(miri))]
use tokio::process::Command;
use windows_sys::Win32::System::Threading::GetProcessId;
#[tokio::test]
async fn obtain_raw_handle() {
let mut cmd = Command::new("cmd");
cmd.kill_on_drop(true);
cmd.arg("/c");
cmd.arg... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/process_change_of_runtime.rs | tokio/tests/process_change_of_runtime.rs | #![cfg(feature = "process")]
#![warn(rust_2018_idioms)]
// This tests test the behavior of `process::Command::spawn` when it is used
// outside runtime, and when `process::Child::wait ` is used in a different
// runtime from which `process::Command::spawn` is used.
#![cfg(all(unix, not(target_os = "freebsd"), not(miri)... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/io_util_empty.rs | tokio/tests/io_util_empty.rs | #![cfg(feature = "full")]
use tokio::io::{AsyncBufReadExt, AsyncReadExt, AsyncSeekExt};
#[tokio::test]
async fn empty_read_is_cooperative() {
tokio::select! {
biased;
_ = async {
loop {
let mut buf = [0u8; 4096];
let _ = tokio::io::empty().read(&mut buf)... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/rt_metrics.rs | tokio/tests/rt_metrics.rs | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi"), target_has_atomic = "64"))]
use std::sync::mpsc;
use std::time::Duration;
use tokio::runtime::Runtime;
use tokio::time;
#[test]
fn num_workers() {
let rt = current_thread();
assert_eq!(1, rt.metrics().num_workers());
let rt ... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/net_panic.rs | tokio/tests/net_panic.rs | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))]
#![cfg(panic = "unwind")]
use std::error::Error;
use tokio::net::{TcpListener, TcpStream};
use tokio::runtime::{Builder, Runtime};
mod support {
pub mod panic;
}
use support::panic::test_panic;
#[test]
#[cfg_attr(miri, ignore)] //... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/net_named_pipe.rs | tokio/tests/net_named_pipe.rs | #![cfg(feature = "full")]
#![cfg(windows)]
use std::io;
use std::time::Duration;
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::net::windows::named_pipe::{ClientOptions, PipeMode, ServerOptions};
use tokio::time;
use windows_sys::Win32::Foundation::{ERROR_NO_DATA, ERROR_PIPE_BUSY};
#[tokio::test]
async fn t... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/sync_mpsc.rs | tokio/tests/sync_mpsc.rs | #![allow(clippy::redundant_clone)]
#![warn(rust_2018_idioms)]
#![cfg(feature = "sync")]
#[cfg(all(target_family = "wasm", not(target_os = "wasi")))]
use wasm_bindgen_test::wasm_bindgen_test as test;
#[cfg(all(target_family = "wasm", not(target_os = "wasi")))]
use wasm_bindgen_test::wasm_bindgen_test as maybe_tokio_tes... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | true |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/rt_handle_block_on.rs | tokio/tests/rt_handle_block_on.rs | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(miri)))]
// All io tests that deal with shutdown is currently ignored because there are known bugs in with
// shutting down the io driver while concurrently registering new resources. See
// https://github.com/tokio-rs/tokio/pull/3569#pullrequestreview-612703... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/unwindsafe.rs | tokio/tests/unwindsafe.rs | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi does not support panic recovery
use std::panic::{RefUnwindSafe, UnwindSafe};
#[test]
fn notify_is_unwind_safe() {
is_unwind_safe::<tokio::sync::Notify>();
}
#[test]
fn join_handle_is_unwind_safe() {
is_unwind_safe::<to... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/io_read_to_end.rs | tokio/tests/io_read_to_end.rs | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use std::pin::Pin;
use std::task::{Context, Poll};
use tokio::io::{AsyncRead, AsyncReadExt, ReadBuf};
use tokio_test::assert_ok;
use tokio_test::io::Builder;
#[tokio::test]
async fn read_to_end() {
let mut buf = vec![];
let mut rd: &[u8] = b"hello world";
... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/task_panic.rs | tokio/tests/task_panic.rs | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))]
#![cfg(panic = "unwind")]
use futures::future;
use std::error::Error;
use tokio::runtime::Builder;
use tokio::task::{self, block_in_place};
mod support {
pub mod panic;
}
use support::panic::test_panic;
#[test]
fn block_in_place_p... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/rt_threaded.rs | tokio/tests/rt_threaded.rs | #![warn(rust_2018_idioms)]
// Too slow on miri.
#![cfg(all(feature = "full", not(target_os = "wasi"), not(miri)))]
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::net::{TcpListener, TcpStream};
use tokio::runtime;
use tokio::sync::oneshot;
use tokio_test::{assert_err, assert_ok};
use std::future::{poll_fn, F... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/tcp_peek.rs | tokio/tests/tcp_peek.rs | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi"), not(miri)))] // Wasi doesn't support bind
// No `socket` on miri.
use tokio::io::AsyncReadExt;
use tokio::net::TcpStream;
use tokio_test::assert_ok;
use std::thread;
use... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/tracing_time.rs | tokio/tests/tracing_time.rs | //! Tests for time resource instrumentation.
//!
//! These tests ensure that the instrumentation for tokio
//! synchronization primitives is correct.
#![warn(rust_2018_idioms)]
#![cfg(all(tokio_unstable, feature = "tracing", target_has_atomic = "64"))]
use std::time::Duration;
use tracing_mock::{expect, subscriber};
... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/fs_symlink_file_windows.rs | tokio/tests/fs_symlink_file_windows.rs | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))] // WASI does not support all fs operations
#![cfg(windows)]
use tempfile::tempdir;
use tokio::fs;
#[tokio::test]
async fn symlink_file_windows() {
let dir = tempdir().unwrap();
let source_path = dir.path().join("foo.txt");
... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/tracing_task.rs | tokio/tests/tracing_task.rs | //! Tests for task instrumentation.
//!
//! These tests ensure that the instrumentation for task spawning and task
//! lifecycles is correct.
#![warn(rust_2018_idioms)]
#![cfg(all(tokio_unstable, feature = "tracing", target_has_atomic = "64"))]
use std::{mem, time::Duration};
use tokio::task;
use tracing_mock::{expec... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/io_panic.rs | tokio/tests/io_panic.rs | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi does not support panic recovery
#![cfg(panic = "unwind")]
use std::task::{Context, Poll};
use std::{error::Error, pin::Pin};
use tokio::io::{self, split, AsyncRead, AsyncWrite, ReadBuf};
mod support {
pub mod panic;
}
use s... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/signal_ctrl_c.rs | tokio/tests/signal_ctrl_c.rs | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(unix)]
#![cfg(not(miri))] // No `sigaction` on Miri
mod support {
pub mod signal;
}
use support::signal::send_signal;
use tokio::signal;
use tokio_test::assert_ok;
#[tokio::test]
async fn ctrl_c() {
let ctrl_c = signal::ctrl_c();
tokio::spawn(a... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/fs_rename.rs | tokio/tests/fs_rename.rs | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))] // WASI does not support all fs operations
use tempfile::tempdir;
use tokio::fs;
#[tokio::test]
async fn rename_file() {
let temp_dir = tempdir().unwrap();
let file_path = temp_dir.path().join("a.txt");
fs::write(&file_pa... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/tracing_sync.rs | tokio/tests/tracing_sync.rs | //! Tests for sync instrumentation.
//!
//! These tests ensure that the instrumentation for tokio
//! synchronization primitives is correct.
#![warn(rust_2018_idioms)]
#![cfg(all(tokio_unstable, feature = "tracing", target_has_atomic = "64"))]
use tokio::sync;
use tracing_mock::{expect, subscriber};
#[tokio::test]
as... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/io_buf_reader.rs | tokio/tests/io_buf_reader.rs | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
// https://github.com/rust-lang/futures-rs/blob/1803948ff091b4eabf7f3bf39e16bbbdefca5cc8/futures/tests/io_buf_reader.rs
use futures::task::{noop_waker_ref, Context, Poll};
use std::cmp;
use std::io::{self, Cursor};
use std::pin::Pin;
use tokio::io::{
AsyncBufRe... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/join_handle_panic.rs | tokio/tests/join_handle_panic.rs | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi doesn't support panic recovery
#![cfg(panic = "unwind")]
struct PanicsOnDrop;
impl Drop for PanicsOnDrop {
fn drop(&mut self) {
panic!("I told you so");
}
}
#[tokio::test]
async fn test_panics_do_not_propagate_... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/buffered.rs | tokio/tests/buffered.rs | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi does not support bind()
use tokio::net::TcpListener;
use tokio_test::assert_ok;
use std::io::prelude::*;
use std::net::TcpStream;
use std::thread;
#[tokio::test]
#[cfg_attr(miri, ignore)] // No `socket` on miri.
async fn echo_... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/io_async_read.rs | tokio/tests/io_async_read.rs | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use tokio::io::AsyncRead;
#[test]
fn assert_obj_safe() {
fn _assert<T>() {}
_assert::<Box<dyn AsyncRead>>();
}
| rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/io_write_int.rs | tokio/tests/io_write_int.rs | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use tokio::io::{AsyncWrite, AsyncWriteExt};
use std::io;
use std::pin::Pin;
use std::task::{Context, Poll};
#[tokio::test]
async fn write_int_should_err_if_write_count_0() {
struct Wr {}
impl AsyncWrite for Wr {
fn poll_write(
self: Pi... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/dump.rs | tokio/tests/dump.rs | #![cfg(all(
tokio_unstable,
feature = "taskdump",
target_os = "linux",
any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64")
))]
use std::hint::black_box;
use tokio::runtime::{self, Handle};
#[inline(never)]
async fn a() {
black_box(b()).await
}
#[inline(never)]
async fn b() {... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/task_join_set.rs | tokio/tests/task_join_set.rs | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use futures::future::{pending, FutureExt};
use std::panic;
use tokio::sync::oneshot;
use tokio::task::{JoinSet, LocalSet};
use tokio::time::Duration;
fn rt() -> tokio::runtime::Runtime {
tokio::runtime::Builder::new_current_thread()
.build()
.un... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/io_buf_writer.rs | tokio/tests/io_buf_writer.rs | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
// https://github.com/rust-lang/futures-rs/blob/1803948ff091b4eabf7f3bf39e16bbbdefca5cc8/futures/tests/io_buf_writer.rs
use futures::task::{Context, Poll};
use std::io::{self, Cursor};
use std::pin::Pin;
use tokio::io::{AsyncSeek, AsyncSeekExt, AsyncWrite, AsyncWri... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/udp.rs | tokio/tests/udp.rs | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi"), not(miri)))] // Wasi does not support bind or UDP
// No `socket` on miri.
use std::future::poll_fn;
use std::io;
use std::sync::Arc;
use tokio::{io::ReadBuf, net::UdpSocke... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/signal_twice.rs | tokio/tests/signal_twice.rs | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(unix)]
#![cfg(not(miri))] // No `sigaction` on Miri.
mod support {
pub mod signal;
}
use support::signal::send_signal;
use tokio::signal::unix::{signal, SignalKind};
#[tokio::test]
async fn twice() {
let kind = SignalKind::user_defined1();
let m... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/coop_budget.rs | tokio/tests/coop_budget.rs | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", target_os = "linux"))]
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::Arc;
use tokio::net::UdpSocket;
use tokio::task::coop::{consume_budget, has_budget_remaining};
const BUDGET: usize = 128;
/// Ensure that UDP sockets have functional budgeting... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/io_poll_aio.rs | tokio/tests/io_poll_aio.rs | #![warn(rust_2018_idioms)]
#![cfg(all(target_os = "freebsd", feature = "net"))]
use mio_aio::{AioFsyncMode, SourceApi};
use std::{
future::Future,
io, mem,
os::fd::AsFd,
os::unix::io::{AsRawFd, RawFd},
pin::{pin, Pin},
task::{Context, Poll},
};
use tempfile::tempfile;
use tokio::io::bsd::{Aio, ... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/net_quickack.rs | tokio/tests/net_quickack.rs | #![warn(rust_2018_idioms)]
#![cfg(all(
feature = "net",
any(
target_os = "linux",
target_os = "android",
target_os = "fuchsia",
target_os = "cygwin",
)
))]
#![cfg(not(miri))] // No `socket` in miri.
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::net::TcpListener;
u... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/uds_datagram.rs | tokio/tests/uds_datagram.rs | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(unix)]
use tokio::io::ReadBuf;
use tokio::net::UnixDatagram;
use tokio::try_join;
use std::future::poll_fn;
use std::io;
use std::sync::Arc;
async fn echo_server(socket: UnixDatagram) -> io::Result<()> {
let mut recv_buf = vec![0u8; 1024];
loop {
... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/rt_poll_callbacks.rs | tokio/tests/rt_poll_callbacks.rs | #![allow(unknown_lints, unexpected_cfgs)]
#![cfg(tokio_unstable)]
use std::sync::{atomic::AtomicUsize, Arc, Mutex};
use tokio::task::yield_now;
#[cfg(not(target_os = "wasi"))]
#[test]
fn callbacks_fire_multi_thread() {
let poll_start_counter = Arc::new(AtomicUsize::new(0));
let poll_stop_counter = Arc::new(A... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/fs_remove_dir_all.rs | tokio/tests/fs_remove_dir_all.rs | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))] // WASI does not support all fs operations
use tempfile::tempdir;
use tokio::fs;
#[tokio::test]
async fn remove_dir_all() {
let temp_dir = tempdir().unwrap();
let test_dir = temp_dir.path().join("test");
fs::create_dir(&te... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/macros_rename_test.rs | tokio/tests/macros_rename_test.rs | #![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi doesn't support threading
#[allow(unused_imports)]
use std as tokio;
use ::tokio as tokio1;
mod test {
pub use ::tokio;
}
async fn compute() -> usize {
let join = tokio1::spawn(async { 1 });
join.await.unwrap()
}
#[tokio1::main(crate = "to... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/test_clock.rs | tokio/tests/test_clock.rs | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use tokio::time::{self, Duration, Instant};
#[tokio::test]
async fn resume_lets_time_move_forward_instead_of_resetting_it() {
let start = Instant::now();
time::pause();
time::advance(Duration::from_secs(10)).await;
let advanced_by_ten_secs = Instant... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/task_builder.rs | tokio/tests/task_builder.rs | #![cfg(all(tokio_unstable, feature = "tracing"))]
use std::rc::Rc;
use tokio::task::{Builder, LocalSet};
#[tokio::test]
async fn spawn_with_name() {
let result = Builder::new()
.name("name")
.spawn(async { "task executed" })
.unwrap()
.await;
assert_eq!(result.unwrap(), "task ... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/macros_test.rs | tokio/tests/macros_test.rs | #![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi doesn't support threading
use tokio::test;
#[test]
async fn test_macro_can_be_used_via_use() {
tokio::spawn(async {}).await.unwrap();
}
#[tokio::test]
async fn test_macro_is_resilient_to_shadowing() {
tokio::spawn(async {}).await.unwrap();
}
//... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/fs_try_exists.rs | tokio/tests/fs_try_exists.rs | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))] // WASI does not support all fs operations
use tempfile::tempdir;
use tokio::fs;
#[tokio::test]
#[cfg_attr(miri, ignore)] // No `chmod` in miri.
async fn try_exists() {
let dir = tempdir().unwrap();
let existing_path = dir.pat... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/io_read_line.rs | tokio/tests/io_read_line.rs | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use std::io::ErrorKind;
use tokio::io::{AsyncBufReadExt, BufReader, Error};
use tokio_test::{assert_ok, io::Builder};
use std::io::Cursor;
#[tokio::test]
async fn read_line() {
let mut buf = String::new();
let mut rd = Cursor::new(b"hello\nworld\n\n");
... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/sync_broadcast_weak.rs | tokio/tests/sync_broadcast_weak.rs | #![allow(clippy::redundant_clone)]
#![warn(rust_2018_idioms)]
#![cfg(feature = "sync")]
#[cfg(all(target_family = "wasm", not(target_os = "wasi")))]
use wasm_bindgen_test::wasm_bindgen_test as test;
use tokio::sync::broadcast::{self, channel};
#[tokio::test]
async fn weak_sender() {
let (tx, mut rx) = channel(11... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/rt_local.rs | tokio/tests/rt_local.rs | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", tokio_unstable))]
use std::panic;
use tokio::runtime::LocalOptions;
use tokio::task::spawn_local;
use tokio::task::LocalSet;
#[test]
fn test_spawn_local_in_runtime() {
let rt = rt();
let res = rt.block_on(async move {
let (tx, rx) = tokio::sync:... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/signal_multi_rt.rs | tokio/tests/signal_multi_rt.rs | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(unix)]
#![cfg(not(miri))] // No `sigaction` on Miri.
mod support {
pub mod signal;
}
use support::signal::send_signal;
use tokio::runtime::Runtime;
use tokio::signal::unix::{signal, SignalKind};
use std::sync::mpsc::channel;
use std::thread;
#[test]
fn... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/io_join.rs | tokio/tests/io_join.rs | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use tokio::io::{join, AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt, Join, ReadBuf};
use std::io;
use std::pin::Pin;
use std::task::{Context, Poll};
struct R;
impl AsyncRead for R {
fn poll_read(
self: Pin<&mut Self>,
_cx: &mut Context<'_... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/io_read.rs | tokio/tests/io_read.rs | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi does not support panic recovery
use tokio::io::{AsyncRead, AsyncReadExt, ReadBuf};
use tokio_test::assert_ok;
use std::io;
use std::pin::Pin;
use std::task::{Context, Poll};
mod support {
pub(crate) mod leaked_buffers;
}
u... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/sync_once_cell.rs | tokio/tests/sync_once_cell.rs | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use std::mem;
use std::sync::atomic::{AtomicU32, Ordering};
use std::sync::Arc;
use std::time::Duration;
use tokio::runtime;
use tokio::sync::OnceCell;
use tokio::sync::SetError;
use tokio::time;
struct Foo {
value: Arc<AtomicU32>,
}
impl Drop for Foo {
fn... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/sync_barrier.rs | tokio/tests/sync_barrier.rs | #![allow(clippy::unnecessary_operation)]
#![warn(rust_2018_idioms)]
#![cfg(feature = "sync")]
#[cfg(all(target_family = "wasm", not(target_os = "wasi")))]
use wasm_bindgen_test::wasm_bindgen_test as test;
use tokio::sync::Barrier;
use tokio_test::task::spawn;
use tokio_test::{assert_pending, assert_ready};
struct I... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/sync_mpsc_weak.rs | tokio/tests/sync_mpsc_weak.rs | #![allow(clippy::redundant_clone)]
#![warn(rust_2018_idioms)]
#![cfg(feature = "sync")]
#[cfg(all(target_family = "wasm", not(target_os = "wasi")))]
use wasm_bindgen_test::wasm_bindgen_test as test;
use std::sync::atomic::AtomicUsize;
use std::sync::atomic::Ordering::{Acquire, Release};
use tokio::sync::mpsc::{self, ... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/fs_copy.rs | tokio/tests/fs_copy.rs | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))] // WASI does not support all fs operations
use tempfile::tempdir;
use tokio::fs;
#[tokio::test]
#[cfg_attr(miri, ignore)] // No `fchmod` in miri.
async fn copy() {
let dir = tempdir().unwrap();
let source_path = dir.path().joi... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/macros_join.rs | tokio/tests/macros_join.rs | #![cfg(feature = "macros")]
#![allow(clippy::disallowed_names)]
use std::sync::Arc;
#[cfg(all(target_family = "wasm", not(target_os = "wasi")))]
#[cfg(target_pointer_width = "64")]
use wasm_bindgen_test::wasm_bindgen_test as test;
#[cfg(all(target_family = "wasm", not(target_os = "wasi")))]
use wasm_bindgen_test::wasm... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/fs_symlink_dir_windows.rs | tokio/tests/fs_symlink_dir_windows.rs | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))] // WASI does not support all fs operations
#![cfg(windows)]
use tempfile::tempdir;
use tokio::fs;
#[tokio::test]
async fn symlink_file_windows() {
const FILE_NAME: &str = "abc.txt";
let temp_dir = tempdir().unwrap();
let ... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/uds_socket.rs | tokio/tests/uds_socket.rs | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(unix)]
use futures::future::try_join;
use std::io;
use tokio::{
io::{AsyncReadExt, AsyncWriteExt},
net::UnixSocket,
};
#[tokio::test]
#[cfg_attr(miri, ignore)] // No `socket` in miri.
async fn datagram_echo_server() -> io::Result<()> {
let dir = ... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/io_fill_buf.rs | tokio/tests/io_fill_buf.rs | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi does not support file operations
use tempfile::NamedTempFile;
use tokio::fs::File;
use tokio::io::{AsyncBufReadExt, BufReader};
use tokio_test::assert_ok;
#[tokio::test]
async fn fill_buf_file() {
let file = NamedTempFile::... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/uds_stream.rs | tokio/tests/uds_stream.rs | #![cfg(feature = "full")]
#![warn(rust_2018_idioms)]
#![cfg(unix)]
#![cfg(not(miri))] // No socket in miri.
use std::io;
#[cfg(target_os = "android")]
use std::os::android::net::SocketAddrExt;
#[cfg(target_os = "linux")]
use std::os::linux::net::SocketAddrExt;
use std::task::Poll;
use tokio::io::{AsyncReadExt, AsyncW... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/duplex_stream.rs | tokio/tests/duplex_stream.rs | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use std::io::IoSlice;
use tokio::io::{AsyncReadExt, AsyncWriteExt};
const HELLO: &[u8] = b"hello world...";
#[tokio::test]
async fn write_vectored() {
let (mut client, mut server) = tokio::io::duplex(64);
let ret = client
.write_vectored(&[IoSlice... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/signal_drop_recv.rs | tokio/tests/signal_drop_recv.rs | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(unix)]
#![cfg(not(miri))] // No `sigaction` in Miri.
mod support {
pub mod signal;
}
use support::signal::send_signal;
use tokio::signal::unix::{signal, SignalKind};
#[tokio::test]
async fn drop_then_get_a_signal() {
let kind = SignalKind::user_defi... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/process_issue_2174.rs | tokio/tests/process_issue_2174.rs | #![cfg(feature = "process")]
#![warn(rust_2018_idioms)]
// This test reveals a difference in behavior of kqueue on FreeBSD. When the
// reader disconnects, there does not seem to be an `EVFILT_WRITE` filter that
// is returned.
//
// It is expected that `EVFILT_WRITE` would be returned with either the
// `EV_EOF` or `E... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/io_chain.rs | tokio/tests/io_chain.rs | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use tokio::io::AsyncReadExt;
use tokio_test::assert_ok;
#[tokio::test]
async fn chain() {
let mut buf = Vec::new();
let rd1: &[u8] = b"hello ";
let rd2: &[u8] = b"world";
let mut rd = rd1.chain(rd2);
assert_ok!(rd.read_to_end(&mut buf).await);
... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/tcp_split.rs | tokio/tests/tcp_split.rs | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi"), not(miri)))] // Wasi doesn't support bind
// No `socket` on miri.
use std::io::Result;
use std::io::{Read, Write};
use std::{net, thread};
use tokio::io::{AsyncReadExt, A... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/signal_notify_both.rs | tokio/tests/signal_notify_both.rs | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(unix)]
#![cfg(not(miri))] // No `sigaction` on Miri.
mod support {
pub mod signal;
}
use support::signal::send_signal;
use tokio::signal::unix::{signal, SignalKind};
#[tokio::test]
async fn notify_both() {
let kind = SignalKind::user_defined2();
... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/sync_set_once.rs | tokio/tests/sync_set_once.rs | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use std::sync::{
atomic::{AtomicU32, Ordering},
Arc,
};
use tokio::sync::SetOnce;
#[derive(Clone)]
struct DropCounter {
drops: Arc<AtomicU32>,
}
impl DropCounter {
fn new() -> Self {
DropCounter {
drops: Arc::new(AtomicU32::new(... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/uds_cred.rs | tokio/tests/uds_cred.rs | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(all(unix, not(target_os = "dragonfly"), not(miri)))] // No `getsockopt` on miri.
use tokio::net::UnixStream;
use libc::getegid;
use libc::geteuid;
#[tokio::test]
#[cfg_attr(
target_os = "netbsd",
ignore = "NetBSD does not support getpeereid() for so... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/tcp_echo.rs | tokio/tests/tcp_echo.rs | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi"), not(miri)))] // Wasi doesn't support bind
// No socket on miri.
use tokio::io::{self, AsyncReadExt, AsyncWriteExt};
use tokio::net::{TcpListener, TcpStream};
use tokio::sy... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/signal_panic.rs | tokio/tests/signal_panic.rs | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(unix)]
#![cfg(panic = "unwind")]
#![cfg(not(miri))] // No `sigaction` on Miri.
use std::error::Error;
use tokio::runtime::Builder;
use tokio::signal::unix::{signal, SignalKind};
mod support {
pub mod panic;
}
use support::panic::test_panic;
#[test]
fn s... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/uds_split.rs | tokio/tests/uds_split.rs | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(unix)]
#![cfg(not(miri))] // No `socket` in miri.
use tokio::io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt};
use tokio::net::UnixStream;
/// Checks that `UnixStream` can be split into a read half and a write half using
/// `UnixStream::split` and `... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/time_wasm.rs | tokio/tests/time_wasm.rs | #![warn(rust_2018_idioms)]
#![cfg(all(target_arch = "wasm32", not(target_os = "wasi")))]
use wasm_bindgen_test::wasm_bindgen_test;
#[wasm_bindgen_test]
#[should_panic]
fn instant_now_panics() {
let _ = tokio::time::Instant::now();
}
#[cfg(all(feature = "rt", not(feature = "time")))]
#[wasm_bindgen_test]
fn runti... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/fs_canonicalize_dir.rs | tokio/tests/fs_canonicalize_dir.rs | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))] // WASI does not support all fs operations
use tokio::fs;
#[tokio::test]
#[cfg(unix)]
async fn canonicalize_root_dir_unix() {
assert_eq!(fs::canonicalize("/.").await.unwrap().to_str().unwrap(), "/");
}
#[tokio::test]
#[cfg(windows... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/io_read_to_string.rs | tokio/tests/io_read_to_string.rs | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use std::io;
use tokio::io::AsyncReadExt;
use tokio_test::assert_ok;
use tokio_test::io::Builder;
#[tokio::test]
async fn read_to_string() {
let mut buf = String::new();
let mut rd: &[u8] = b"hello world";
let n = assert_ok!(rd.read_to_string(&mut buf)... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/task_id.rs | tokio/tests/task_id.rs | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use std::error::Error;
use std::future::Future;
use std::pin::Pin;
use std::task::{Context, Poll};
use tokio::runtime::Runtime;
use tokio::sync::oneshot;
use tokio::task::{self, Id, LocalSet};
mod support {
pub mod panic;
}
use support::panic::test_panic;
#[to... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/tcp_into_std.rs | tokio/tests/tcp_into_std.rs | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi"), not(miri)))] // Wasi doesn't support bind
// No socket on `miri`.
use std::io::Read;
use std::io::Result;
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::net::Tcp... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/task_blocking.rs | tokio/tests/task_blocking.rs | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi"), not(miri)))] // Wasi doesn't support threads
use tokio::{runtime, task, time};
use tokio_test::assert_ok;
use std::thread;
use std::time::Duration;
mod support {
pub(crate) mod mpsc_stream;
}
#[tokio::test]
async fn basic_blocking(... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/tcp_into_split.rs | tokio/tests/tcp_into_split.rs | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi"), not(miri)))] // Wasi doesn't support bind
// No `socket` on miri.
use std::io::{Error, ErrorKind, Result};
use std::io::{Read, Write};
use std::{net, thread};
use tokio::... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/sync_mutex_owned.rs | tokio/tests/sync_mutex_owned.rs | #![warn(rust_2018_idioms)]
#![cfg(feature = "sync")]
#[cfg(all(target_family = "wasm", not(target_os = "wasi")))]
use wasm_bindgen_test::wasm_bindgen_test as test;
#[cfg(all(target_family = "wasm", not(target_os = "wasi")))]
use wasm_bindgen_test::wasm_bindgen_test as maybe_tokio_test;
#[cfg(not(all(target_family = "... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/task_trace_self.rs | tokio/tests/task_trace_self.rs | #![allow(unknown_lints, unexpected_cfgs)]
#![cfg(all(
tokio_unstable,
feature = "taskdump",
target_os = "linux",
any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64")
))]
use std::future::Future;
use std::pin::Pin;
use std::sync::{Arc, Mutex};
use std::task::{Context, Poll};
use std... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
tokio-rs/tokio | https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/tests/io_write_all.rs | tokio/tests/io_write_all.rs | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use tokio::io::{AsyncWrite, AsyncWriteExt};
use tokio_test::assert_ok;
use bytes::BytesMut;
use std::cmp;
use std::io;
use std::pin::Pin;
use std::task::{Context, Poll};
#[tokio::test]
async fn write_all() {
struct Wr {
buf: BytesMut,
cnt: usiz... | rust | MIT | 41d1877689f8669902b003a6affce60bdfeb3025 | 2026-01-04T15:33:40.250594Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.