id stringlengths 22 133 | text stringlengths 40 40.2k | arch stringclasses 1
value | syntax stringclasses 1
value | kind stringclasses 4
values | repo stringclasses 27
values | path stringlengths 5 116 | license stringclasses 6
values | commit stringlengths 40 40 | source_host stringclasses 1
value | category stringclasses 16
values | source_url stringlengths 85 196 | line_start int64 1 4.28k | line_end int64 4 4.31k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
tokio-rs/tokio:tokio/tests/runtime_threaded.rs:3 | let (a_tx, a_rx) = oneshot::channel();
let (b_tx, b_rx) = mpsc::channel();
thread::spawn(|| {
use std::time::Duration;
thread::sleep(Duration::from_millis(1000));
a_tx.send(()).unwrap();
});
let rt = Runtime::new().unwrap();
rt.block_on(async move {
a_rx.await.unwr... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_threaded.rs | MIT | bd3f3270dbf632a7e23e82dd93605db1fe050ee9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/bd3f3270dbf632a7e23e82dd93605db1fe050ee9/tokio/tests/runtime_threaded.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/runtime_threaded.rs:4 | let mut e = tokio_executor::enter().unwrap();
e.block_on(rt.shutdown_on_idle());
assert_eq!(ITER, *cnt.lock().unwrap());
}
#[test]
fn nested_enter() {
use std::panic;
let rt = Runtime::new().unwrap();
rt.block_on(async {
assert_err!(tokio_executor::enter());
// Since this is test... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_threaded.rs | MIT | bd3f3270dbf632a7e23e82dd93605db1fe050ee9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/bd3f3270dbf632a7e23e82dd93605db1fe050ee9/tokio/tests/runtime_threaded.rs | 121 | 180 |
tokio-rs/tokio:tokio/tests/runtime_threaded.rs:5 | #[test]
fn after_start_and_before_stop_is_called() {
use std::sync::atomic::{AtomicUsize, Ordering};
let _ = env_logger::try_init();
let after_start = Arc::new(AtomicUsize::new(0));
let before_stop = Arc::new(AtomicUsize::new(0));
let after_inner = after_start.clone();
let before_inner = befo... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/runtime_threaded.rs | MIT | bd3f3270dbf632a7e23e82dd93605db1fe050ee9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/bd3f3270dbf632a7e23e82dd93605db1fe050ee9/tokio/tests/runtime_threaded.rs | 161 | 194 |
tokio-rs/tokio:tokio/tests/signal_ctrl_c.rs:1 | #![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 | rust | testsuite | tokio-rs/tokio | tokio/tests/signal_ctrl_c.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/signal_ctrl_c.rs | 1 | 23 |
tokio-rs/tokio:tokio/tests/signal_ctrl_c.rs:1 | #![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::sync::oneshot;
use tokio_test::assert_ok;
#[tokio::test]
async fn ctrl_c() {
let ctrl_c = signal::ctr... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/signal_ctrl_c.rs | MIT | 161b8c80d58a4a070c7f41db18d43ea258737db7 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/161b8c80d58a4a070c7f41db18d43ea258737db7/tokio/tests/signal_ctrl_c.rs | 1 | 31 |
tokio-rs/tokio:tokio/tests/signal_ctrl_c.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(unix)]
mod support {
pub mod signal;
}
use support::signal::send_signal;
use tokio::signal;
use tokio::sync::oneshot;
use tokio_test::assert_ok;
#[tokio::test]
async fn ctrl_c() {
let ctrl_c = signal::ctrl_c();
let (fire, wait) = oneshot::chann... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/signal_ctrl_c.rs | MIT | 7b4c999341809588a427a9a80d310ee4aa1c1a21 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7b4c999341809588a427a9a80d310ee4aa1c1a21/tokio/tests/signal_ctrl_c.rs | 1 | 30 |
tokio-rs/tokio:tokio/tests/signal_ctrl_c.rs:1 | #![cfg(unix)]
#![warn(rust_2018_idioms)]
mod support {
pub mod signal;
}
use support::signal::send_signal;
use tokio::signal;
use tokio::sync::oneshot;
use tokio_test::assert_ok;
#[tokio::test]
async fn ctrl_c() {
let ctrl_c = signal::ctrl_c();
let (fire, wait) = oneshot::channel();
// NB: simulate... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/signal_ctrl_c.rs | MIT | 8a7e57786a5dca139f5b4261685e22991ded0859 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/tests/signal_ctrl_c.rs | 1 | 29 |
tokio-rs/tokio:tokio/tests/signal_ctrl_c.rs:1 | #![cfg(unix)]
#![warn(rust_2018_idioms)]
mod support {
pub mod signal;
}
use support::signal::send_signal;
use tokio::prelude::*;
use tokio::signal;
use tokio::sync::oneshot;
#[tokio::test]
async fn ctrl_c() {
let ctrl_c = signal::ctrl_c().expect("failed to init ctrl_c");
let (fire, wait) = oneshot::cha... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/signal_ctrl_c.rs | MIT | 227533d456fe32e48ffcd3796f1e6c8f9318b230 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/227533d456fe32e48ffcd3796f1e6c8f9318b230/tokio/tests/signal_ctrl_c.rs | 1 | 28 |
tokio-rs/tokio:tokio/tests/signal_drop_recv.rs:1 | #![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 | rust | testsuite | tokio-rs/tokio | tokio/tests/signal_drop_recv.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/signal_drop_recv.rs | 1 | 23 |
tokio-rs/tokio:tokio/tests/signal_drop_recv.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(unix)]
#![cfg(not(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_defined1();
let sig = signa... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/signal_drop_recv.rs | MIT | 161b8c80d58a4a070c7f41db18d43ea258737db7 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/161b8c80d58a4a070c7f41db18d43ea258737db7/tokio/tests/signal_drop_recv.rs | 1 | 23 |
tokio-rs/tokio:tokio/tests/signal_drop_recv.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(unix)]
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_defined1();
let sig = signal(kind).expect("fai... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/signal_drop_recv.rs | MIT | 7b4c999341809588a427a9a80d310ee4aa1c1a21 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7b4c999341809588a427a9a80d310ee4aa1c1a21/tokio/tests/signal_drop_recv.rs | 1 | 22 |
tokio-rs/tokio:tokio/tests/signal_drop_recv.rs:1 | #![cfg(unix)]
#![warn(rust_2018_idioms)]
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_defined1();
let sig = signal(kind).expect("failed to create first signal... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/signal_drop_recv.rs | MIT | 8a7e57786a5dca139f5b4261685e22991ded0859 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/tests/signal_drop_recv.rs | 1 | 21 |
tokio-rs/tokio:tokio/tests/signal_drop_rt.rs:1 | #![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::runtime::Runtime;
use tokio::signal::unix::{signal, SignalKind};
#[test]
fn dropping_loops_does_not_cause_starvation() {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/signal_drop_rt.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/signal_drop_rt.rs | 1 | 45 |
tokio-rs/tokio:tokio/tests/signal_drop_rt.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(unix)]
#![cfg(not(miri))]
mod support {
pub mod signal;
}
use support::signal::send_signal;
use tokio::runtime::Runtime;
use tokio::signal::unix::{signal, SignalKind};
#[test]
fn dropping_loops_does_not_cause_starvation() {
let kind = SignalKind::us... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/signal_drop_rt.rs | MIT | 161b8c80d58a4a070c7f41db18d43ea258737db7 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/161b8c80d58a4a070c7f41db18d43ea258737db7/tokio/tests/signal_drop_rt.rs | 1 | 45 |
tokio-rs/tokio:tokio/tests/signal_drop_rt.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(unix)]
mod support {
pub mod signal;
}
use support::signal::send_signal;
use tokio::runtime::Runtime;
use tokio::signal::unix::{signal, SignalKind};
#[test]
fn dropping_loops_does_not_cause_starvation() {
let kind = SignalKind::user_defined1();
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/signal_drop_rt.rs | MIT | 8880222036f37c6204c8466f25e828447f16dacb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8880222036f37c6204c8466f25e828447f16dacb/tokio/tests/signal_drop_rt.rs | 1 | 44 |
tokio-rs/tokio:tokio/tests/signal_drop_rt.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(unix)]
mod support {
pub mod signal;
}
use support::signal::send_signal;
use tokio::runtime::Runtime;
use tokio::signal::unix::{signal, SignalKind};
#[test]
fn dropping_loops_does_not_cause_starvation() {
let kind = SignalKind::user_defined1();
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/signal_drop_rt.rs | MIT | d600ab9a8f37e9eff3fa8587069a816b65b6da0b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d600ab9a8f37e9eff3fa8587069a816b65b6da0b/tokio/tests/signal_drop_rt.rs | 1 | 45 |
tokio-rs/tokio:tokio/tests/signal_drop_rt.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(unix)]
mod support {
pub mod signal;
}
use support::signal::send_signal;
use tokio::runtime::Runtime;
use tokio::signal::unix::{signal, SignalKind};
#[test]
fn dropping_loops_does_not_cause_starvation() {
let kind = SignalKind::user_defined1();
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/signal_drop_rt.rs | MIT | 7b4c999341809588a427a9a80d310ee4aa1c1a21 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7b4c999341809588a427a9a80d310ee4aa1c1a21/tokio/tests/signal_drop_rt.rs | 1 | 45 |
tokio-rs/tokio:tokio/tests/signal_drop_rt.rs:1 | #![cfg(unix)]
#![warn(rust_2018_idioms)]
mod support {
pub mod signal;
}
use support::signal::send_signal;
use tokio::runtime::Runtime;
use tokio::signal::unix::{signal, SignalKind};
#[test]
fn dropping_loops_does_not_cause_starvation() {
let kind = SignalKind::user_defined1();
let mut first_rt = rt();
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/signal_drop_rt.rs | MIT | 8546ff826db8dba1e39b4119ad909fb6cab2492a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8546ff826db8dba1e39b4119ad909fb6cab2492a/tokio/tests/signal_drop_rt.rs | 1 | 44 |
tokio-rs/tokio:tokio/tests/signal_drop_rt.rs:1 | #![cfg(unix)]
#![warn(rust_2018_idioms)]
mod support {
pub mod signal;
}
use support::signal::send_signal;
use tokio::runtime::Runtime;
use tokio::signal::unix::{signal, SignalKind};
#[test]
fn dropping_loops_does_not_cause_starvation() {
let kind = SignalKind::user_defined1();
let mut first_rt = rt();
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/signal_drop_rt.rs | MIT | 3f0eabe7798de624f5ee9c7562803bfb97e6088f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3f0eabe7798de624f5ee9c7562803bfb97e6088f/tokio/tests/signal_drop_rt.rs | 1 | 43 |
tokio-rs/tokio:tokio/tests/signal_drop_rt.rs:1 | #![cfg(unix)]
#![warn(rust_2018_idioms)]
mod support {
pub mod signal;
}
use support::signal::send_signal;
use tokio::runtime::Runtime;
use tokio::signal::unix::{signal, SignalKind};
#[test]
fn dropping_loops_does_not_cause_starvation() {
let kind = SignalKind::user_defined1();
let mut first_rt = rt();
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/signal_drop_rt.rs | MIT | 8a7e57786a5dca139f5b4261685e22991ded0859 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/tests/signal_drop_rt.rs | 1 | 43 |
tokio-rs/tokio:tokio/tests/signal_drop_rt.rs:1 | #![cfg(unix)]
#![warn(rust_2018_idioms)]
mod support {
pub mod signal;
}
use support::signal::send_signal;
use tokio::prelude::*;
use tokio::runtime::Runtime;
use tokio::signal::unix::{signal, SignalKind};
#[test]
fn dropping_loops_does_not_cause_starvation() {
let kind = SignalKind::user_defined1();
le... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/signal_drop_rt.rs | MIT | d70c928d88dff9e3e8d673b8ee02bce131598550 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d70c928d88dff9e3e8d673b8ee02bce131598550/tokio/tests/signal_drop_rt.rs | 1 | 44 |
tokio-rs/tokio:tokio/tests/signal_drop_signal.rs:1 | #![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 dropping_signal_does_not_deregister_any_other_instances() {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/signal_drop_signal.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/signal_drop_signal.rs | 1 | 27 |
tokio-rs/tokio:tokio/tests/signal_drop_signal.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(unix)]
#![cfg(not(miri))]
mod support {
pub mod signal;
}
use support::signal::send_signal;
use tokio::signal::unix::{signal, SignalKind};
#[tokio::test]
async fn dropping_signal_does_not_deregister_any_other_instances() {
let kind = SignalKind::use... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/signal_drop_signal.rs | MIT | 161b8c80d58a4a070c7f41db18d43ea258737db7 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/161b8c80d58a4a070c7f41db18d43ea258737db7/tokio/tests/signal_drop_signal.rs | 1 | 27 |
tokio-rs/tokio:tokio/tests/signal_drop_signal.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(unix)]
mod support {
pub mod signal;
}
use support::signal::send_signal;
use tokio::signal::unix::{signal, SignalKind};
#[tokio::test]
async fn dropping_signal_does_not_deregister_any_other_instances() {
let kind = SignalKind::user_defined1();
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/signal_drop_signal.rs | MIT | 7b4c999341809588a427a9a80d310ee4aa1c1a21 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7b4c999341809588a427a9a80d310ee4aa1c1a21/tokio/tests/signal_drop_signal.rs | 1 | 26 |
tokio-rs/tokio:tokio/tests/signal_drop_signal.rs:1 | #![cfg(unix)]
#![warn(rust_2018_idioms)]
mod support {
pub mod signal;
}
use support::signal::send_signal;
use tokio::signal::unix::{signal, SignalKind};
#[tokio::test]
async fn dropping_signal_does_not_deregister_any_other_instances() {
let kind = SignalKind::user_defined1();
// Signals should not star... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/signal_drop_signal.rs | MIT | 8a7e57786a5dca139f5b4261685e22991ded0859 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/tests/signal_drop_signal.rs | 1 | 25 |
tokio-rs/tokio:tokio/tests/signal_info.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(any(
target_os = "dragonfly",
target_os = "freebsd",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
target_os = "illumos"
))]
#![cfg(not(miri))] // No `sigaction` on Miri
mod support {
pub mod signal;
}
use suppo... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/signal_info.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/signal_info.rs | 1 | 35 |
tokio-rs/tokio:tokio/tests/signal_info.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(any(
target_os = "dragonfly",
target_os = "freebsd",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
target_os = "illumos"
))]
#![cfg(not(miri))] // No `sigaction` on Miri
mod support {
pub mod signal;
}
use suppo... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/signal_info.rs | MIT | 480c010b01cf32e36d6cba307ca436fabb6d95fa | github | async-runtime | https://github.com/tokio-rs/tokio/blob/480c010b01cf32e36d6cba307ca436fabb6d95fa/tokio/tests/signal_info.rs | 1 | 43 |
tokio-rs/tokio:tokio/tests/signal_multi_rt.rs:1 | #![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 | rust | testsuite | tokio-rs/tokio | tokio/tests/signal_multi_rt.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/signal_multi_rt.rs | 1 | 55 |
tokio-rs/tokio:tokio/tests/signal_multi_rt.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(unix)]
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 multi_loop() {
// An "ordinary" (non-futu... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/signal_multi_rt.rs | MIT | 8880222036f37c6204c8466f25e828447f16dacb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8880222036f37c6204c8466f25e828447f16dacb/tokio/tests/signal_multi_rt.rs | 1 | 54 |
tokio-rs/tokio:tokio/tests/signal_multi_rt.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(unix)]
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 multi_loop() {
// An "ordinary" (non-futu... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/signal_multi_rt.rs | MIT | d600ab9a8f37e9eff3fa8587069a816b65b6da0b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d600ab9a8f37e9eff3fa8587069a816b65b6da0b/tokio/tests/signal_multi_rt.rs | 1 | 55 |
tokio-rs/tokio:tokio/tests/signal_multi_rt.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(unix)]
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 multi_loop() {
// An "ordinary" (non-futu... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/signal_multi_rt.rs | MIT | 7b4c999341809588a427a9a80d310ee4aa1c1a21 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7b4c999341809588a427a9a80d310ee4aa1c1a21/tokio/tests/signal_multi_rt.rs | 1 | 55 |
tokio-rs/tokio:tokio/tests/signal_multi_rt.rs:1 | #![cfg(unix)]
#![warn(rust_2018_idioms)]
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 multi_loop() {
// An "ordinary" (non-future) channel
let (sende... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/signal_multi_rt.rs | MIT | 8546ff826db8dba1e39b4119ad909fb6cab2492a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8546ff826db8dba1e39b4119ad909fb6cab2492a/tokio/tests/signal_multi_rt.rs | 1 | 54 |
tokio-rs/tokio:tokio/tests/signal_multi_rt.rs:1 | #![cfg(unix)]
#![warn(rust_2018_idioms)]
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 multi_loop() {
// An "ordinary" (non-future) channel
let (sende... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/signal_multi_rt.rs | MIT | 3f0eabe7798de624f5ee9c7562803bfb97e6088f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3f0eabe7798de624f5ee9c7562803bfb97e6088f/tokio/tests/signal_multi_rt.rs | 1 | 53 |
tokio-rs/tokio:tokio/tests/signal_multi_rt.rs:1 | #![cfg(unix)]
#![warn(rust_2018_idioms)]
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 multi_loop() {
// An "ordinary" (non-future) channel
let (sende... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/signal_multi_rt.rs | MIT | 8a7e57786a5dca139f5b4261685e22991ded0859 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/tests/signal_multi_rt.rs | 1 | 53 |
tokio-rs/tokio:tokio/tests/signal_multi_rt.rs:1 | #![cfg(unix)]
#![warn(rust_2018_idioms)]
mod support {
pub mod signal;
}
use support::signal::send_signal;
use tokio::prelude::*;
use tokio::runtime::Runtime;
use tokio::signal::unix::{signal, SignalKind};
use std::sync::mpsc::channel;
use std::thread;
#[test]
fn multi_loop() {
// An "ordinary" (non-future)... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/signal_multi_rt.rs | MIT | d70c928d88dff9e3e8d673b8ee02bce131598550 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d70c928d88dff9e3e8d673b8ee02bce131598550/tokio/tests/signal_multi_rt.rs | 1 | 54 |
tokio-rs/tokio:tokio/tests/signal_no_rt.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(unix)]
#![cfg(not(miri))] // No `sigaction` on Miri.
use tokio::signal::unix::{signal, SignalKind};
#[cfg_attr(target_os = "wasi", ignore = "Wasi does not support panic recovery")]
#[test]
#[should_panic]
fn no_runtime_panics_creating_signals() {
let _ =... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/signal_no_rt.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/signal_no_rt.rs | 1 | 13 |
tokio-rs/tokio:tokio/tests/signal_no_rt.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(unix)]
use tokio::signal::unix::{signal, SignalKind};
#[cfg_attr(target_os = "wasi", ignore = "Wasi does not support panic recovery")]
#[test]
#[should_panic]
fn no_runtime_panics_creating_signals() {
let _ = signal(SignalKind::hangup());
} | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/signal_no_rt.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/signal_no_rt.rs | 1 | 12 |
tokio-rs/tokio:tokio/tests/signal_no_rt.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(unix)]
use tokio::signal::unix::{signal, SignalKind};
#[cfg_attr(tokio_wasi, ignore = "Wasi does not support panic recovery")]
#[test]
#[should_panic]
fn no_runtime_panics_creating_signals() {
let _ = signal(SignalKind::hangup());
} | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/signal_no_rt.rs | MIT | b2ada60e701d5c9e6644cf8fc42a100774f8e23f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/tests/signal_no_rt.rs | 1 | 12 |
tokio-rs/tokio:tokio/tests/signal_no_rt.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(unix)]
use tokio::signal::unix::{signal, SignalKind};
#[test]
#[should_panic]
fn no_runtime_panics_creating_signals() {
let _ = signal(SignalKind::hangup());
} | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/signal_no_rt.rs | MIT | 7b4c999341809588a427a9a80d310ee4aa1c1a21 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7b4c999341809588a427a9a80d310ee4aa1c1a21/tokio/tests/signal_no_rt.rs | 1 | 11 |
tokio-rs/tokio:tokio/tests/signal_no_rt.rs:1 | #![cfg(unix)]
#![warn(rust_2018_idioms)]
use tokio::signal::unix::{signal, SignalKind};
#[test]
#[should_panic]
fn no_runtime_panics_creating_signals() {
let _ = signal(SignalKind::hangup());
} | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/signal_no_rt.rs | MIT | 227533d456fe32e48ffcd3796f1e6c8f9318b230 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/227533d456fe32e48ffcd3796f1e6c8f9318b230/tokio/tests/signal_no_rt.rs | 1 | 10 |
tokio-rs/tokio:tokio/tests/signal_notify_both.rs:1 | #![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 | rust | testsuite | tokio-rs/tokio | tokio/tests/signal_notify_both.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/signal_notify_both.rs | 1 | 24 |
tokio-rs/tokio:tokio/tests/signal_notify_both.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(unix)]
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();
let mut signal1 = signal(kind).expect("faile... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/signal_notify_both.rs | MIT | 7b4c999341809588a427a9a80d310ee4aa1c1a21 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7b4c999341809588a427a9a80d310ee4aa1c1a21/tokio/tests/signal_notify_both.rs | 1 | 23 |
tokio-rs/tokio:tokio/tests/signal_notify_both.rs:1 | #![cfg(unix)]
#![warn(rust_2018_idioms)]
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();
let mut signal1 = signal(kind).expect("failed to create signal1");
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/signal_notify_both.rs | MIT | 8a7e57786a5dca139f5b4261685e22991ded0859 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/tests/signal_notify_both.rs | 1 | 22 |
tokio-rs/tokio:tokio/tests/signal_panic.rs:1 | #![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 | rust | testsuite | tokio-rs/tokio | tokio/tests/signal_panic.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/signal_panic.rs | 1 | 31 |
tokio-rs/tokio:tokio/tests/signal_panic.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(unix)]
#![cfg(panic = "unwind")]
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 signal_panic_caller() -> Result<(), Box<dyn Err... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/signal_panic.rs | MIT | 58edfc61abe4acdc2dda485c1d66715790b9315c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/58edfc61abe4acdc2dda485c1d66715790b9315c/tokio/tests/signal_panic.rs | 1 | 30 |
tokio-rs/tokio:tokio/tests/signal_panic.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(unix)]
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 signal_panic_caller() -> Result<(), Box<dyn Error>> {
let panic_locat... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/signal_panic.rs | MIT | 18efef7d3b926750c0b026a401e85e723f401854 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/18efef7d3b926750c0b026a401e85e723f401854/tokio/tests/signal_panic.rs | 1 | 29 |
tokio-rs/tokio:tokio/tests/signal_realtime.rs:1 | #![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 | rust | testsuite | tokio-rs/tokio | tokio/tests/signal_realtime.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/signal_realtime.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/signal_realtime.rs:2 | // Now send signals to each of the registered signals.
for signum in libc::SIGRTMIN()..=sigrt_max() {
send_signal(signum);
}
let futures = signals
.into_iter()
.map(|(signum, mut sig)| async move {
let res = sig.recv().await;
(signum, res)
})
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/signal_realtime.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/signal_realtime.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/signal_realtime.rs:3 | if !missing.is_empty() {
msg.push_str("missing signals for:\n");
for signum in missing {
msg.push_str(&format!("- {}\n", sigrtnum_to_string(signum)));
}
}
panic!("{}", msg);
}
fn sigrt_max() -> c_int {
// Generally, you would expect this to be SIGRTMAX. But QEMU only su... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/signal_realtime.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/signal_realtime.rs | 81 | 105 |
tokio-rs/tokio:tokio/tests/signal_twice.rs:1 | #![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 | rust | testsuite | tokio-rs/tokio | tokio/tests/signal_twice.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/signal_twice.rs | 1 | 23 |
tokio-rs/tokio:tokio/tests/signal_twice.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(unix)]
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 mut sig = signal(kind).expect("failed to get si... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/signal_twice.rs | MIT | 7b4c999341809588a427a9a80d310ee4aa1c1a21 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7b4c999341809588a427a9a80d310ee4aa1c1a21/tokio/tests/signal_twice.rs | 1 | 22 |
tokio-rs/tokio:tokio/tests/signal_twice.rs:1 | #![cfg(unix)]
#![warn(rust_2018_idioms)]
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 mut sig = signal(kind).expect("failed to get signal");
for _ in 0..2... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/signal_twice.rs | MIT | 8a7e57786a5dca139f5b4261685e22991ded0859 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/tests/signal_twice.rs | 1 | 21 |
tokio-rs/tokio:tokio/tests/signal_usr1.rs:1 | #![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};
use tokio_test::assert_ok;
#[tokio::test]
async fn signal_usr1() {
let mut signal =... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/signal_usr1.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/signal_usr1.rs | 1 | 24 |
tokio-rs/tokio:tokio/tests/signal_usr1.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(unix)]
mod support {
pub mod signal;
}
use support::signal::send_signal;
use tokio::signal::unix::{signal, SignalKind};
use tokio_test::assert_ok;
#[tokio::test]
async fn signal_usr1() {
let mut signal = assert_ok!(
signal(SignalKind::user_d... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/signal_usr1.rs | MIT | 7b4c999341809588a427a9a80d310ee4aa1c1a21 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7b4c999341809588a427a9a80d310ee4aa1c1a21/tokio/tests/signal_usr1.rs | 1 | 23 |
tokio-rs/tokio:tokio/tests/signal_usr1.rs:1 | #![cfg(unix)]
#![warn(rust_2018_idioms)]
mod support {
pub mod signal;
}
use support::signal::send_signal;
use tokio::signal::unix::{signal, SignalKind};
use tokio_test::assert_ok;
#[tokio::test]
async fn signal_usr1() {
let mut signal = assert_ok!(
signal(SignalKind::user_defined1()),
"faile... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/signal_usr1.rs | MIT | 8a7e57786a5dca139f5b4261685e22991ded0859 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/tests/signal_usr1.rs | 1 | 22 |
tokio-rs/tokio:tokio/tests/signal_usr1.rs:1 | #![cfg(unix)]
#![warn(rust_2018_idioms)]
mod support {
pub mod signal;
}
use support::signal::send_signal;
use tokio::prelude::*;
use tokio::signal::unix::{signal, SignalKind};
use tokio_test::assert_ok;
#[tokio::test]
async fn signal_usr1() {
let signal = assert_ok!(
signal(SignalKind::user_defined1... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/signal_usr1.rs | MIT | 227533d456fe32e48ffcd3796f1e6c8f9318b230 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/227533d456fe32e48ffcd3796f1e6c8f9318b230/tokio/tests/signal_usr1.rs | 1 | 23 |
tokio-rs/tokio:tokio/tests/stream_chain.rs:1 | use tokio::stream::{self, Stream, StreamExt};
use tokio::sync::mpsc;
use tokio_test::{assert_pending, assert_ready, task};
#[tokio::test]
async fn basic_usage() {
let one = stream::iter(vec![1, 2, 3]);
let two = stream::iter(vec![4, 5, 6]);
let mut stream = one.chain(two);
assert_eq!(stream.size_hint... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/stream_chain.rs | MIT | 236629d1be7208612cbe5388e7ffebf85b73c157 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/236629d1be7208612cbe5388e7ffebf85b73c157/tokio/tests/stream_chain.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/stream_chain.rs:2 | let mut stream = task::spawn(rx1.chain(rx2));
assert_eq!(stream.size_hint(), (0, None));
assert_pending!(stream.poll_next());
tx2.send(2).unwrap();
assert!(!stream.is_woken());
assert_pending!(stream.poll_next());
tx1.send(1).unwrap();
assert!(stream.is_woken());
assert_eq!(Some(1), ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/stream_chain.rs | MIT | 236629d1be7208612cbe5388e7ffebf85b73c157 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/236629d1be7208612cbe5388e7ffebf85b73c157/tokio/tests/stream_chain.rs | 41 | 95 |
tokio-rs/tokio:tokio/tests/stream_chain.rs:3 | _cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<()>> {
panic!()
}
fn size_hint(&self) -> (usize, Option<usize>) {
(usize::max_value(), Some(usize::max_value()))
}
}
let m1 = Monster;
let m2 = Monster;
let m = m1.chain(m2);
asser... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/stream_chain.rs | MIT | 236629d1be7208612cbe5388e7ffebf85b73c157 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/236629d1be7208612cbe5388e7ffebf85b73c157/tokio/tests/stream_chain.rs | 81 | 95 |
tokio-rs/tokio:tokio/tests/stream_chain.rs:2 | let mut stream = task::spawn(rx1.chain(rx2));
assert_eq!(stream.size_hint(), (0, None));
assert_pending!(stream.poll_next());
tx2.send(2).unwrap();
assert!(!stream.is_woken());
assert_pending!(stream.poll_next());
tx1.send(1).unwrap();
assert!(stream.is_woken());
assert_eq!(Some(1), ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/stream_chain.rs | MIT | 7c3f1cb4a3d6076cb5e1aedf2311f62c8a7a2fd7 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7c3f1cb4a3d6076cb5e1aedf2311f62c8a7a2fd7/tokio/tests/stream_chain.rs | 41 | 71 |
tokio-rs/tokio:tokio/tests/stream_collect.rs:1 | use tokio::stream::{self, StreamExt};
use tokio::sync::mpsc;
use tokio_test::{assert_pending, assert_ready, assert_ready_err, assert_ready_ok, task};
#[allow(clippy::let_unit_value)]
#[tokio::test]
async fn empty_unit() {
// Drains the stream.
let mut iter = vec![(), (), ()].into_iter();
let _: () = stream... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/stream_collect.rs | MIT | aa171f2aa9593f64e78bde2c679a4c9bd9d9d163 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/aa171f2aa9593f64e78bde2c679a4c9bd9d9d163/tokio/tests/stream_collect.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/stream_collect.rs:2 | let mut fut = task::spawn(rx.collect::<Vec<i32>>());
assert_pending!(fut.poll());
tx.send(1).unwrap();
assert!(fut.is_woken());
assert_pending!(fut.poll());
tx.send(2).unwrap();
assert!(fut.is_woken());
assert_pending!(fut.poll());
drop(tx);
assert!(fut.is_woken());
let coll ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/stream_collect.rs | MIT | aa171f2aa9593f64e78bde2c679a4c9bd9d9d163 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/aa171f2aa9593f64e78bde2c679a4c9bd9d9d163/tokio/tests/stream_collect.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/stream_collect.rs:3 | async fn collect_str_items() {
let (tx, rx) = mpsc::unbounded_channel();
let mut fut = task::spawn(rx.collect::<String>());
assert_pending!(fut.poll());
tx.send("hello ").unwrap();
assert!(fut.is_woken());
assert_pending!(fut.poll());
tx.send("world").unwrap();
assert!(fut.is_woken())... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/stream_collect.rs | MIT | aa171f2aa9593f64e78bde2c679a4c9bd9d9d163 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/aa171f2aa9593f64e78bde2c679a4c9bd9d9d163/tokio/tests/stream_collect.rs | 81 | 137 |
tokio-rs/tokio:tokio/tests/stream_collect.rs:4 | #[tokio::test]
async fn collect_results_err() {
let (tx, rx) = mpsc::unbounded_channel();
let mut fut = task::spawn(rx.collect::<Result<String, &str>>());
assert_pending!(fut.poll());
tx.send(Ok("hello ")).unwrap();
assert!(fut.is_woken());
assert_pending!(fut.poll());
tx.send(Err("oh no"... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/stream_collect.rs | MIT | aa171f2aa9593f64e78bde2c679a4c9bd9d9d163 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/aa171f2aa9593f64e78bde2c679a4c9bd9d9d163/tokio/tests/stream_collect.rs | 121 | 137 |
tokio-rs/tokio:tokio/tests/stream_collect.rs:1 | use tokio::stream::{self, StreamExt};
use tokio::sync::mpsc;
use tokio_test::{assert_pending, assert_ready, assert_ready_err, assert_ready_ok, task};
use bytes::{Bytes, BytesMut};
#[allow(clippy::let_unit_value)]
#[tokio::test]
async fn empty_unit() {
// Drains the stream.
let mut iter = vec![(), (), ()].into... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/stream_collect.rs | MIT | 476bf0084a7abb86ed2338095da4c7297453f00c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/476bf0084a7abb86ed2338095da4c7297453f00c/tokio/tests/stream_collect.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/stream_collect.rs:2 | async fn empty_string() {
let coll: String = stream::empty::<&str>().collect().await;
assert!(coll.is_empty());
}
#[tokio::test]
async fn empty_result() {
let coll: Result<Vec<u32>, &str> = stream::empty().collect().await;
assert_eq!(Ok(vec![]), coll);
}
#[tokio::test]
async fn collect_vec_items() {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/stream_collect.rs | MIT | 476bf0084a7abb86ed2338095da4c7297453f00c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/476bf0084a7abb86ed2338095da4c7297453f00c/tokio/tests/stream_collect.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/stream_collect.rs:3 | assert!(fut.is_woken());
assert_pending!(fut.poll());
tx.send("world".to_string()).unwrap();
assert!(fut.is_woken());
assert_pending!(fut.poll());
drop(tx);
assert!(fut.is_woken());
let coll = assert_ready!(fut.poll());
assert_eq!("hello world", coll);
}
#[tokio::test]
async fn collec... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/stream_collect.rs | MIT | 476bf0084a7abb86ed2338095da4c7297453f00c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/476bf0084a7abb86ed2338095da4c7297453f00c/tokio/tests/stream_collect.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/stream_collect.rs:4 | tx.send(&b"hello "[..]).unwrap();
assert!(fut.is_woken());
assert_pending!(fut.poll());
tx.send(&b"world"[..]).unwrap();
assert!(fut.is_woken());
assert_pending!(fut.poll());
drop(tx);
assert!(fut.is_woken());
let coll = assert_ready!(fut.poll());
assert_eq!(&b"hello world"[..], co... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/stream_collect.rs | MIT | 476bf0084a7abb86ed2338095da4c7297453f00c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/476bf0084a7abb86ed2338095da4c7297453f00c/tokio/tests/stream_collect.rs | 121 | 172 |
tokio-rs/tokio:tokio/tests/stream_collect.rs:5 | assert_pending!(fut.poll());
tx.send(Ok("hello ")).unwrap();
assert!(fut.is_woken());
assert_pending!(fut.poll());
tx.send(Err("oh no")).unwrap();
assert!(fut.is_woken());
let err = assert_ready_err!(fut.poll());
assert_eq!("oh no", err);
} | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/stream_collect.rs | MIT | 476bf0084a7abb86ed2338095da4c7297453f00c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/476bf0084a7abb86ed2338095da4c7297453f00c/tokio/tests/stream_collect.rs | 161 | 172 |
tokio-rs/tokio:tokio/tests/stream_collect.rs:1 | use tokio::stream::{self, StreamExt};
use tokio::sync::mpsc;
use tokio_test::{assert_pending, assert_ready, assert_ready_err, assert_ready_ok, task};
use bytes::{Bytes, BytesMut};
#[tokio::test]
async fn empty_unit() {
// Drains the stream.
let mut iter = vec![(), (), ()].into_iter();
let _: () = stream::... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/stream_collect.rs | MIT | eb1a8e1792b2c4b296be47a0681421c90bbdbf7a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/eb1a8e1792b2c4b296be47a0681421c90bbdbf7a/tokio/tests/stream_collect.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/stream_collect.rs:2 | let coll: String = stream::empty::<&str>().collect().await;
assert!(coll.is_empty());
}
#[tokio::test]
async fn empty_result() {
let coll: Result<Vec<u32>, &str> = stream::empty().collect().await;
assert_eq!(Ok(vec![]), coll);
}
#[tokio::test]
async fn collect_vec_items() {
let (tx, rx) = mpsc::unboun... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/stream_collect.rs | MIT | eb1a8e1792b2c4b296be47a0681421c90bbdbf7a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/eb1a8e1792b2c4b296be47a0681421c90bbdbf7a/tokio/tests/stream_collect.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/stream_collect.rs:3 | assert_pending!(fut.poll());
tx.send("world".to_string()).unwrap();
assert!(fut.is_woken());
assert_pending!(fut.poll());
drop(tx);
assert!(fut.is_woken());
let coll = assert_ready!(fut.poll());
assert_eq!("hello world", coll);
}
#[tokio::test]
async fn collect_str_items() {
let (tx, ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/stream_collect.rs | MIT | eb1a8e1792b2c4b296be47a0681421c90bbdbf7a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/eb1a8e1792b2c4b296be47a0681421c90bbdbf7a/tokio/tests/stream_collect.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/stream_empty.rs:1 | use tokio::stream::{self, Stream, StreamExt};
#[tokio::test]
async fn basic_usage() {
let mut stream = stream::empty::<i32>();
for _ in 0..2 {
assert_eq!(stream.size_hint(), (0, Some(0)));
assert_eq!(None, stream.next().await);
}
} | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/stream_empty.rs | MIT | 8471e0a0ee7f6c973fb517ccb7efcf6c7e2ddc6f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8471e0a0ee7f6c973fb517ccb7efcf6c7e2ddc6f/tokio/tests/stream_empty.rs | 1 | 11 |
tokio-rs/tokio:tokio/tests/stream_fuse.rs:1 | use tokio::stream::{Stream, StreamExt};
use std::pin::Pin;
use std::task::{Context, Poll};
// a stream which alternates between Some and None
struct Alternate {
state: i32,
}
impl Stream for Alternate {
type Item = i32;
fn poll_next(mut self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<Option<i32>> {... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/stream_fuse.rs | MIT | bd8971cd95b2c182c16d8bfc5ee43754ee4e9c96 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/bd8971cd95b2c182c16d8bfc5ee43754ee4e9c96/tokio/tests/stream_fuse.rs | 1 | 50 |
tokio-rs/tokio:tokio/tests/stream_fuse.rs:1 | use tokio::stream::{Stream, StreamExt};
use std::pin::Pin;
use std::task::{Context, Poll};
// a stream which alternates between Some and None
struct Alternate {
state: i32,
}
impl Stream for Alternate {
type Item = i32;
fn poll_next(mut self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<Option<i32>> {... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/stream_fuse.rs | MIT | cfd9b36d89e6b665c11248a86de8934cb4a7bdff | github | async-runtime | https://github.com/tokio-rs/tokio/blob/cfd9b36d89e6b665c11248a86de8934cb4a7bdff/tokio/tests/stream_fuse.rs | 1 | 50 |
tokio-rs/tokio:tokio/tests/stream_iter.rs:1 | use tokio::stream;
use tokio_test::task;
use std::iter;
#[tokio::test]
async fn coop() {
let mut stream = task::spawn(stream::iter(iter::repeat(1)));
for _ in 0..10_000 {
if stream.poll_next().is_pending() {
assert!(stream.is_woken());
return;
}
}
panic!("did ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/stream_iter.rs | MIT | 186196b911bb7cbbd67e74b4ef051d3daf2d64c1 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/186196b911bb7cbbd67e74b4ef051d3daf2d64c1/tokio/tests/stream_iter.rs | 1 | 18 |
tokio-rs/tokio:tokio/tests/stream_merge.rs:1 | use tokio::stream::{self, Stream, StreamExt};
use tokio::sync::mpsc;
use tokio_test::task;
use tokio_test::{assert_pending, assert_ready};
#[tokio::test]
async fn merge_sync_streams() {
let mut s = stream::iter(vec![0, 2, 4, 6]).merge(stream::iter(vec![1, 3, 5]));
for i in 0..7 {
let rem = 7 - i;
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/stream_merge.rs | MIT | 236629d1be7208612cbe5388e7ffebf85b73c157 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/236629d1be7208612cbe5388e7ffebf85b73c157/tokio/tests/stream_merge.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/stream_merge.rs:2 | drop(tx1);
assert!(rx.is_woken());
assert_pending!(rx.poll_next());
tx2.send(3).unwrap();
assert!(rx.is_woken());
assert_eq!(Some(3), assert_ready!(rx.poll_next()));
assert_pending!(rx.poll_next());
drop(tx2);
assert!(rx.is_woken());
assert_eq!(None, assert_ready!(rx.poll_next()));... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/stream_merge.rs | MIT | 236629d1be7208612cbe5388e7ffebf85b73c157 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/236629d1be7208612cbe5388e7ffebf85b73c157/tokio/tests/stream_merge.rs | 41 | 78 |
tokio-rs/tokio:tokio/tests/stream_merge.rs:1 | use tokio::stream::{self, Stream, StreamExt};
use tokio::sync::mpsc;
use tokio_test::task;
use tokio_test::{assert_pending, assert_ready};
#[tokio::test]
async fn merge_sync_streams() {
let mut s = stream::iter(vec![0, 2, 4, 6]).merge(stream::iter(vec![1, 3, 5]));
for i in 0..7 {
let rem = 7 - i;
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/stream_merge.rs | MIT | 0ba6e9abdbe1b42997d183adf5a39488c9543200 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0ba6e9abdbe1b42997d183adf5a39488c9543200/tokio/tests/stream_merge.rs | 1 | 54 |
tokio-rs/tokio:tokio/tests/stream_once.rs:1 | use tokio::stream::{self, Stream, StreamExt};
#[tokio::test]
async fn basic_usage() {
let mut one = stream::once(1);
assert_eq!(one.size_hint(), (1, Some(1)));
assert_eq!(Some(1), one.next().await);
assert_eq!(one.size_hint(), (0, Some(0)));
assert_eq!(None, one.next().await);
} | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/stream_once.rs | MIT | 64d23899118dfc8f1d4d7a9b60c015e43260df80 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/64d23899118dfc8f1d4d7a9b60c015e43260df80/tokio/tests/stream_once.rs | 1 | 12 |
tokio-rs/tokio:tokio/tests/stream_pending.rs:1 | use tokio::stream::{self, Stream, StreamExt};
use tokio_test::{assert_pending, task};
#[tokio::test]
async fn basic_usage() {
let mut stream = stream::pending::<i32>();
for _ in 0..2 {
assert_eq!(stream.size_hint(), (0, None));
let mut next = task::spawn(async { stream.next().await });
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/stream_pending.rs | MIT | 8471e0a0ee7f6c973fb517ccb7efcf6c7e2ddc6f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8471e0a0ee7f6c973fb517ccb7efcf6c7e2ddc6f/tokio/tests/stream_pending.rs | 1 | 14 |
tokio-rs/tokio:tokio/tests/stream_reader.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use bytes::Bytes;
use tokio::io::{stream_reader, AsyncReadExt};
use tokio::stream::iter;
#[tokio::test]
async fn test_stream_reader() -> std::io::Result<()> {
let stream = iter(vec![
Ok(Bytes::from_static(&[])),
Ok(Bytes::from_static(&[0, 1, 2, ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/stream_reader.rs | MIT | e10471dc3af90f3467a3eb6f970e1a322c247d08 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e10471dc3af90f3467a3eb6f970e1a322c247d08/tokio/tests/stream_reader.rs | 1 | 35 |
tokio-rs/tokio:tokio/tests/stream_stream_map.rs:1 | use tokio::stream::{self, pending, Stream, StreamExt, StreamMap};
use tokio::sync::mpsc;
use tokio_test::{assert_ok, assert_pending, assert_ready, task};
use std::pin::Pin;
macro_rules! assert_ready_some {
($($t:tt)*) => {
match assert_ready!($($t)*) {
Some(v) => v,
None => panic!(... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/stream_stream_map.rs | MIT | b704c53b9cc76eaf8c9c6585f8444c4515d27728 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b704c53b9cc76eaf8c9c6585f8444c4515d27728/tokio/tests/stream_stream_map.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/stream_stream_map.rs:2 | let (tx, rx) = mpsc::unbounded_channel();
assert_ready_none!(map.poll_next());
assert!(map.insert("foo", rx).is_none());
assert!(map.contains_key("foo"));
assert!(!map.contains_key("bar"));
assert_eq!(map.len(), 1);
assert!(!map.is_empty());
assert_pending!(map.poll_next());
assert_... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/stream_stream_map.rs | MIT | b704c53b9cc76eaf8c9c6585f8444c4515d27728 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b704c53b9cc76eaf8c9c6585f8444c4515d27728/tokio/tests/stream_stream_map.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/stream_stream_map.rs:3 | map.insert("foo", rx1);
map.insert("bar", rx2);
assert_pending!(map.poll_next());
assert_ok!(tx1.send(1));
assert!(map.is_woken());
let (k, v) = assert_ready_some!(map.poll_next());
assert_eq!(k, "foo");
assert_eq!(v, 1);
assert_pending!(map.poll_next());
assert_ok!(tx2.send(2))... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/stream_stream_map.rs | MIT | b704c53b9cc76eaf8c9c6585f8444c4515d27728 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b704c53b9cc76eaf8c9c6585f8444c4515d27728/tokio/tests/stream_stream_map.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/stream_stream_map.rs:4 | assert_eq!(v[1].0, "foo");
assert_eq!(v[1].1, 3);
drop(tx1);
assert!(map.is_woken());
assert_pending!(map.poll_next());
drop(tx2);
assert_ready_none!(map.poll_next());
}
#[tokio::test]
async fn insert_remove() {
let mut map = task::spawn(StreamMap::new());
let (tx, rx) = mpsc::unbound... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/stream_stream_map.rs | MIT | b704c53b9cc76eaf8c9c6585f8444c4515d27728 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b704c53b9cc76eaf8c9c6585f8444c4515d27728/tokio/tests/stream_stream_map.rs | 121 | 180 |
tokio-rs/tokio:tokio/tests/stream_stream_map.rs:5 | async fn replace() {
let mut map = task::spawn(StreamMap::new());
let (tx1, rx1) = mpsc::unbounded_channel();
let (tx2, rx2) = mpsc::unbounded_channel();
assert!(map.insert("foo", rx1).is_none());
assert_pending!(map.poll_next());
let _rx1 = map.insert("foo", rx2).unwrap();
assert_pendin... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/stream_stream_map.rs | MIT | b704c53b9cc76eaf8c9c6585f8444c4515d27728 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b704c53b9cc76eaf8c9c6585f8444c4515d27728/tokio/tests/stream_stream_map.rs | 161 | 220 |
tokio-rs/tokio:tokio/tests/stream_stream_map.rs:6 | let mut map = StreamMap::new();
map.insert("a", pin_box(stream::iter(vec![1])));
map.insert("b", pin_box(stream::iter(vec![1, 2])));
map.insert("c", pin_box(pending()));
let size_hint = map.size_hint();
assert_eq!(size_hint, (3, None));
}
#[test]
fn new_capacity_zero() {
let map = StreamMap::... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/stream_stream_map.rs | MIT | b704c53b9cc76eaf8c9c6585f8444c4515d27728 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b704c53b9cc76eaf8c9c6585f8444c4515d27728/tokio/tests/stream_stream_map.rs | 201 | 260 |
tokio-rs/tokio:tokio/tests/stream_stream_map.rs:7 | #[test]
fn iter_values() {
let mut map = StreamMap::new();
map.insert("a", stream::iter(vec![1]));
map.insert("b", stream::iter(vec![1, 2]));
map.insert("c", stream::iter(vec![1, 2, 3]));
let mut size_hints = map.values().map(|s| s.size_hint().0).collect::<Vec<_>>();
size_hints.sort_unstable(... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/stream_stream_map.rs | MIT | b704c53b9cc76eaf8c9c6585f8444c4515d27728 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b704c53b9cc76eaf8c9c6585f8444c4515d27728/tokio/tests/stream_stream_map.rs | 241 | 300 |
tokio-rs/tokio:tokio/tests/stream_stream_map.rs:8 | assert_ready_some!(map.poll_next());
map.clear();
assert_ready_none!(map.poll_next());
assert!(map.is_empty());
}
#[test]
fn contains_key_borrow() {
let mut map = StreamMap::new();
map.insert("foo".to_string(), pending::<()>());
assert!(map.contains_key("foo"));
}
#[test]
fn one_ready_many_... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/stream_stream_map.rs | MIT | b704c53b9cc76eaf8c9c6585f8444c4515d27728 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b704c53b9cc76eaf8c9c6585f8444c4515d27728/tokio/tests/stream_stream_map.rs | 281 | 340 |
tokio-rs/tokio:tokio/tests/stream_stream_map.rs:9 | inner: T,
}
impl<T: Stream + Unpin> Stream for DidPoll<T> {
type Item = T::Item;
fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>)
-> Poll<Option<T::Item>>
{
self.did_poll = true;
Pin::new(&mut self.inner).p... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/stream_stream_map.rs | MIT | b704c53b9cc76eaf8c9c6585f8444c4515d27728 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b704c53b9cc76eaf8c9c6585f8444c4515d27728/tokio/tests/stream_stream_map.rs | 321 | 372 |
tokio-rs/tokio:tokio/tests/stream_stream_map.rs:10 | for stream in map.values() {
assert!(stream.did_poll);
}
}
}
}
}
fn pin_box<T: Stream<Item = U> + 'static, U>(s: T) -> Pin<Box<dyn Stream<Item = U>>> {
Box::pin(s)
} | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/stream_stream_map.rs | MIT | b704c53b9cc76eaf8c9c6585f8444c4515d27728 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b704c53b9cc76eaf8c9c6585f8444c4515d27728/tokio/tests/stream_stream_map.rs | 361 | 372 |
tokio-rs/tokio:tokio/tests/stream_stream_map.rs:3 | map.insert("foo", rx1);
map.insert("bar", rx2);
assert_pending!(map.poll_next());
assert_ok!(tx1.send(1));
assert!(map.is_woken());
let (k, v) = assert_ready_some!(map.poll_next());
assert_eq!(k, "foo");
assert_eq!(v, 1);
assert_pending!(map.poll_next());
assert_ok!(tx2.send(2))... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/stream_stream_map.rs | MIT | ab24a655adc1eb0d0c6951d5df2b815c671ac7d2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ab24a655adc1eb0d0c6951d5df2b815c671ac7d2/tokio/tests/stream_stream_map.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/stream_stream_map.rs:5 | async fn replace() {
let mut map = task::spawn(StreamMap::new());
let (tx1, rx1) = mpsc::unbounded_channel();
let (tx2, rx2) = mpsc::unbounded_channel();
assert!(map.insert("foo", rx1).is_none());
assert_pending!(map.poll_next());
let _rx1 = map.insert("foo", rx2).unwrap();
assert_pendin... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/stream_stream_map.rs | MIT | ab24a655adc1eb0d0c6951d5df2b815c671ac7d2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ab24a655adc1eb0d0c6951d5df2b815c671ac7d2/tokio/tests/stream_stream_map.rs | 161 | 220 |
tokio-rs/tokio:tokio/tests/stream_stream_map.rs:6 | let mut map = StreamMap::new();
map.insert("a", pin_box(stream::iter(vec![1])));
map.insert("b", pin_box(stream::iter(vec![1, 2])));
map.insert("c", pin_box(pending()));
let size_hint = map.size_hint();
assert_eq!(size_hint, (3, None));
}
#[test]
fn new_capacity_zero() {
let map = StreamMap::... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/stream_stream_map.rs | MIT | ab24a655adc1eb0d0c6951d5df2b815c671ac7d2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ab24a655adc1eb0d0c6951d5df2b815c671ac7d2/tokio/tests/stream_stream_map.rs | 201 | 260 |
tokio-rs/tokio:tokio/tests/stream_stream_map.rs:7 | }
#[test]
fn iter_values() {
let mut map = StreamMap::new();
map.insert("a", stream::iter(vec![1]));
map.insert("b", stream::iter(vec![1, 2]));
map.insert("c", stream::iter(vec![1, 2, 3]));
let mut size_hints = map.values().map(|s| s.size_hint().0).collect::<Vec<_>>();
size_hints.sort();
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/stream_stream_map.rs | MIT | ab24a655adc1eb0d0c6951d5df2b815c671ac7d2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ab24a655adc1eb0d0c6951d5df2b815c671ac7d2/tokio/tests/stream_stream_map.rs | 241 | 300 |
tokio-rs/tokio:tokio/tests/stream_stream_map.rs:8 | map.insert("b", stream::iter(vec![1, 2]));
map.insert("c", stream::iter(vec![1, 2, 3]));
assert_ready_some!(map.poll_next());
map.clear();
assert_ready_none!(map.poll_next());
assert!(map.is_empty());
}
#[test]
fn contains_key_borrow() {
let mut map = StreamMap::new();
map.insert("foo".t... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/stream_stream_map.rs | MIT | ab24a655adc1eb0d0c6951d5df2b815c671ac7d2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ab24a655adc1eb0d0c6951d5df2b815c671ac7d2/tokio/tests/stream_stream_map.rs | 281 | 340 |
tokio-rs/tokio:tokio/tests/stream_stream_map.rs:9 | struct DidPoll<T> {
did_poll: bool,
inner: T,
}
impl<T: Stream + Unpin> Stream for DidPoll<T> {
type Item = T::Item;
fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>)
-> Poll<Option<T::Item>>
{
self.... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/stream_stream_map.rs | MIT | ab24a655adc1eb0d0c6951d5df2b815c671ac7d2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ab24a655adc1eb0d0c6951d5df2b815c671ac7d2/tokio/tests/stream_stream_map.rs | 321 | 374 |
tokio-rs/tokio:tokio/tests/stream_stream_map.rs:10 | assert_eq!(expect, map.values().count());
for stream in map.values() {
assert!(stream.did_poll);
}
}
}
}
}
fn pin_box<T: Stream<Item = U> + 'static, U>(s: T) -> Pin<Box<dyn Stream<Item = U>>> {
Box::pin(s)
} | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/stream_stream_map.rs | MIT | ab24a655adc1eb0d0c6951d5df2b815c671ac7d2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ab24a655adc1eb0d0c6951d5df2b815c671ac7d2/tokio/tests/stream_stream_map.rs | 361 | 374 |
tokio-rs/tokio:tokio/tests/stream_timeout.rs:1 | #![cfg(feature = "full")]
use tokio::stream::{self, StreamExt};
use tokio::time::{self, sleep, Duration};
use tokio_test::*;
use futures::StreamExt as _;
async fn maybe_sleep(idx: i32) -> i32 {
if idx % 2 == 0 {
sleep(ms(200)).await;
}
idx
}
fn ms(n: u64) -> Duration {
Duration::from_millis(... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/stream_timeout.rs | MIT | ae67851f11b7cc1f577de8ce21767ce3e2c7aff9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ae67851f11b7cc1f577de8ce21767ce3e2c7aff9/tokio/tests/stream_timeout.rs | 1 | 60 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.