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/join_handle_panic.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi does not support panic recovery
struct PanicsOnDrop;
impl Drop for PanicsOnDrop {
fn drop(&mut self) {
panic!("I told you so");
}
}
#[tokio::test]
async fn test_panics_do_not_propagate_when_dropping_join_handle... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/join_handle_panic.rs | MIT | 6d3f92dddc510e9276191cfab1b0432ce8248589 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6d3f92dddc510e9276191cfab1b0432ce8248589/tokio/tests/join_handle_panic.rs | 1 | 20 |
tokio-rs/tokio:tokio/tests/join_handle_panic.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
struct PanicsOnDrop;
impl Drop for PanicsOnDrop {
fn drop(&mut self) {
panic!("I told you so");
}
}
#[tokio::test]
async fn test_panics_do_not_propagate_when_dropping_join_handle() {
let join_handle = tokio::spawn(async move { PanicsOnDrop });
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/join_handle_panic.rs | MIT | 111dd66f3edc29d473c4741fa8829c123a70acb8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/111dd66f3edc29d473c4741fa8829c123a70acb8/tokio/tests/join_handle_panic.rs | 1 | 20 |
tokio-rs/tokio:tokio/tests/length_delimited.rs:1 | #![cfg(feature = "broken")]
#![deny(warnings, rust_2018_idioms)]
use bytes::{BufMut, Bytes, BytesMut};
use futures::Async::*;
use futures::{Poll, Sink, Stream};
use std::collections::VecDeque;
use std::io;
use tokio::codec::*;
use tokio::io::{AsyncRead, AsyncWrite};
macro_rules! mock {
($($x:expr,)*) => {{
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/length_delimited.rs | MIT | 29e417c257c62ae95cfa73f6b56825b3f833dde8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/29e417c257c62ae95cfa73f6b56825b3f833dde8/tokio/tests/length_delimited.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/length_delimited.rs:2 | fn read_single_frame_one_packet_little_endian() {
let mut io = length_delimited::Builder::new()
.little_endian()
.new_read(mock! {
Ok(b"\x09\x00\x00\x00abcdefghi"[..].into()),
});
assert_eq!(io.poll().unwrap(), Ready(Some(b"abcdefghi"[..].into())));
assert_eq!(io.poll().... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/length_delimited.rs | MIT | 29e417c257c62ae95cfa73f6b56825b3f833dde8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/29e417c257c62ae95cfa73f6b56825b3f833dde8/tokio/tests/length_delimited.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/length_delimited.rs:3 | );
assert_eq!(io.poll().unwrap(), Ready(Some(b"abcdefghi"[..].into())));
assert_eq!(io.poll().unwrap(), Ready(Some(b"123"[..].into())));
assert_eq!(io.poll().unwrap(), Ready(Some(b"hello world"[..].into())));
assert_eq!(io.poll().unwrap(), Ready(None));
}
#[test]
fn read_single_frame_multi_packet() {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/length_delimited.rs | MIT | 29e417c257c62ae95cfa73f6b56825b3f833dde8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/29e417c257c62ae95cfa73f6b56825b3f833dde8/tokio/tests/length_delimited.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/length_delimited.rs:4 | }
#[test]
fn read_single_frame_multi_packet_wait() {
let mut io = FramedRead::new(
mock! {
Ok(b"\x00\x00"[..].into()),
Err(would_block()),
Ok(b"\x00\x09abc"[..].into()),
Err(would_block()),
Ok(b"defghi"[..].into()),
Err(would_block()),... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/length_delimited.rs | MIT | 29e417c257c62ae95cfa73f6b56825b3f833dde8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/29e417c257c62ae95cfa73f6b56825b3f833dde8/tokio/tests/length_delimited.rs | 121 | 180 |
tokio-rs/tokio:tokio/tests/length_delimited.rs:5 | assert_eq!(io.poll().unwrap(), NotReady);
assert_eq!(io.poll().unwrap(), NotReady);
assert_eq!(io.poll().unwrap(), Ready(Some(b"abcdefghi"[..].into())));
assert_eq!(io.poll().unwrap(), NotReady);
assert_eq!(io.poll().unwrap(), NotReady);
assert_eq!(io.poll().unwrap(), Ready(Some(b"123"[..].into())))... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/length_delimited.rs | MIT | 29e417c257c62ae95cfa73f6b56825b3f833dde8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/29e417c257c62ae95cfa73f6b56825b3f833dde8/tokio/tests/length_delimited.rs | 161 | 220 |
tokio-rs/tokio:tokio/tests/length_delimited.rs:6 | #[test]
fn read_incomplete_payload() {
let mut io = FramedRead::new(
mock! {
Ok(b"\x00\x00\x00\x09ab"[..].into()),
Err(would_block()),
Ok(b"cd"[..].into()),
Err(would_block()),
},
LengthDelimitedCodec::new(),
);
assert_eq!(io.poll().un... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/length_delimited.rs | MIT | 29e417c257c62ae95cfa73f6b56825b3f833dde8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/29e417c257c62ae95cfa73f6b56825b3f833dde8/tokio/tests/length_delimited.rs | 201 | 260 |
tokio-rs/tokio:tokio/tests/length_delimited.rs:7 | #[test]
fn read_update_max_frame_len_in_flight() {
let mut io = length_delimited::Builder::new().new_read(mock! {
Ok(b"\x00\x00\x00\x09abcd"[..].into()),
Err(would_block()),
Ok(b"efghi"[..].into()),
Ok(b"\x00\x00\x00\x09abcdefghi"[..].into()),
});
assert_eq!(io.poll().unwrap... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/length_delimited.rs | MIT | 29e417c257c62ae95cfa73f6b56825b3f833dde8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/29e417c257c62ae95cfa73f6b56825b3f833dde8/tokio/tests/length_delimited.rs | 241 | 300 |
tokio-rs/tokio:tokio/tests/length_delimited.rs:8 | #[test]
fn read_single_multi_frame_one_packet_skip_none_adjusted() {
let mut data: Vec<u8> = vec![];
data.extend_from_slice(b"xx\x00\x09abcdefghi");
data.extend_from_slice(b"yy\x00\x03123");
data.extend_from_slice(b"zz\x00\x0bhello world");
let mut io = length_delimited::Builder::new()
.len... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/length_delimited.rs | MIT | 29e417c257c62ae95cfa73f6b56825b3f833dde8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/29e417c257c62ae95cfa73f6b56825b3f833dde8/tokio/tests/length_delimited.rs | 281 | 340 |
tokio-rs/tokio:tokio/tests/length_delimited.rs:9 | });
assert_eq!(io.poll().unwrap(), Ready(Some(b"abcdefghi"[..].into())));
assert_eq!(io.poll().unwrap(), Ready(Some(b"123"[..].into())));
assert_eq!(io.poll().unwrap(), Ready(Some(b"hello world"[..].into())));
assert_eq!(io.poll().unwrap(), Ready(None));
}
#[test]
fn write_single_frame_length_adjusted... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/length_delimited.rs | MIT | 29e417c257c62ae95cfa73f6b56825b3f833dde8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/29e417c257c62ae95cfa73f6b56825b3f833dde8/tokio/tests/length_delimited.rs | 321 | 380 |
tokio-rs/tokio:tokio/tests/length_delimited.rs:10 | assert!(io.poll_complete().unwrap().is_ready());
assert!(io.get_ref().calls.is_empty());
}
#[test]
fn write_single_multi_frame_one_packet() {
let mut io = FramedWrite::new(
mock! {
Ok(b"\x00\x00\x00\x09"[..].into()),
Ok(b"abcdefghi"[..].into()),
Ok(b"\x00\x00\x00\x03... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/length_delimited.rs | MIT | 29e417c257c62ae95cfa73f6b56825b3f833dde8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/29e417c257c62ae95cfa73f6b56825b3f833dde8/tokio/tests/length_delimited.rs | 361 | 420 |
tokio-rs/tokio:tokio/tests/length_delimited.rs:11 | Ok(b"hello world"[..].into()),
Ok(Flush),
},
LengthDelimitedCodec::new(),
);
assert!(io.start_send(Bytes::from("abcdefghi")).unwrap().is_ready());
assert!(io.poll_complete().unwrap().is_ready());
assert!(io.start_send(Bytes::from("123")).unwrap().is_ready());
assert!(io.... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/length_delimited.rs | MIT | 29e417c257c62ae95cfa73f6b56825b3f833dde8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/29e417c257c62ae95cfa73f6b56825b3f833dde8/tokio/tests/length_delimited.rs | 401 | 460 |
tokio-rs/tokio:tokio/tests/length_delimited.rs:12 | #[test]
fn write_single_frame_little_endian() {
let mut io = length_delimited::Builder::new()
.little_endian()
.new_write(mock! {
Ok(b"\x09\x00\x00\x00"[..].into()),
Ok(b"abcdefghi"[..].into()),
Ok(Flush),
});
assert!(io.start_send(Bytes::from("abcdef... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/length_delimited.rs | MIT | 29e417c257c62ae95cfa73f6b56825b3f833dde8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/29e417c257c62ae95cfa73f6b56825b3f833dde8/tokio/tests/length_delimited.rs | 441 | 500 |
tokio-rs/tokio:tokio/tests/length_delimited.rs:13 | assert!(io.get_ref().calls.is_empty());
}
#[test]
fn write_update_max_frame_len_at_rest() {
let mut io = length_delimited::Builder::new().new_write(mock! {
Ok(b"\x00\x00\x00\x06"[..].into()),
Ok(b"abcdef"[..].into()),
Ok(Flush),
});
assert!(io.start_send(Bytes::from("abcdef")).unwr... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/length_delimited.rs | MIT | 29e417c257c62ae95cfa73f6b56825b3f833dde8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/29e417c257c62ae95cfa73f6b56825b3f833dde8/tokio/tests/length_delimited.rs | 481 | 540 |
tokio-rs/tokio:tokio/tests/length_delimited.rs:14 | }
#[test]
fn write_zero() {
let mut io = length_delimited::Builder::new().new_write(mock! {});
assert!(io.start_send(Bytes::from("abcdef")).unwrap().is_ready());
assert_eq!(
io.poll_complete().unwrap_err().kind(),
io::ErrorKind::WriteZero
);
assert!(io.get_ref().calls.is_empty());
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/length_delimited.rs | MIT | 29e417c257c62ae95cfa73f6b56825b3f833dde8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/29e417c257c62ae95cfa73f6b56825b3f833dde8/tokio/tests/length_delimited.rs | 521 | 580 |
tokio-rs/tokio:tokio/tests/length_delimited.rs:15 | Flush,
}
use self::Op::*;
impl io::Read for Mock {
fn read(&mut self, dst: &mut [u8]) -> io::Result<usize> {
match self.calls.pop_front() {
Some(Ok(Op::Data(data))) => {
debug_assert!(dst.len() >= data.len());
dst[..data.len()].copy_from_slice(&data[..]);
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/length_delimited.rs | MIT | 29e417c257c62ae95cfa73f6b56825b3f833dde8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/29e417c257c62ae95cfa73f6b56825b3f833dde8/tokio/tests/length_delimited.rs | 561 | 620 |
tokio-rs/tokio:tokio/tests/length_delimited.rs:16 | Some(Ok(_)) => panic!(),
Some(Err(e)) => Err(e),
None => Ok(()),
}
}
}
impl AsyncWrite for Mock {
fn shutdown(&mut self) -> Poll<(), io::Error> {
Ok(Ready(()))
}
}
impl<'a> From<&'a [u8]> for Op {
fn from(src: &'a [u8]) -> Op {
Op::Data(src.into())
}... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/length_delimited.rs | MIT | 29e417c257c62ae95cfa73f6b56825b3f833dde8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/29e417c257c62ae95cfa73f6b56825b3f833dde8/tokio/tests/length_delimited.rs | 601 | 624 |
tokio-rs/tokio:tokio/tests/length_delimited.rs:1 | #![deny(warnings, rust_2018_idioms)]
use bytes::{BufMut, Bytes, BytesMut};
use futures::Async::*;
use futures::{Poll, Sink, Stream};
use std::collections::VecDeque;
use std::io;
use tokio::codec::*;
use tokio::io::{AsyncRead, AsyncWrite};
macro_rules! mock {
($($x:expr,)*) => {{
let mut v = VecDeque::new(... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/length_delimited.rs | MIT | cb4aea394e6851ae8cc45a68beeaf2c93cc9a0c0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/cb4aea394e6851ae8cc45a68beeaf2c93cc9a0c0/tokio/tests/length_delimited.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/length_delimited.rs:2 | let mut io = length_delimited::Builder::new()
.little_endian()
.new_read(mock! {
Ok(b"\x09\x00\x00\x00abcdefghi"[..].into()),
});
assert_eq!(io.poll().unwrap(), Ready(Some(b"abcdefghi"[..].into())));
assert_eq!(io.poll().unwrap(), Ready(None));
}
#[test]
fn read_single_fram... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/length_delimited.rs | MIT | cb4aea394e6851ae8cc45a68beeaf2c93cc9a0c0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/cb4aea394e6851ae8cc45a68beeaf2c93cc9a0c0/tokio/tests/length_delimited.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/length_delimited.rs:3 | assert_eq!(io.poll().unwrap(), Ready(Some(b"abcdefghi"[..].into())));
assert_eq!(io.poll().unwrap(), Ready(Some(b"123"[..].into())));
assert_eq!(io.poll().unwrap(), Ready(Some(b"hello world"[..].into())));
assert_eq!(io.poll().unwrap(), Ready(None));
}
#[test]
fn read_single_frame_multi_packet() {
let ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/length_delimited.rs | MIT | cb4aea394e6851ae8cc45a68beeaf2c93cc9a0c0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/cb4aea394e6851ae8cc45a68beeaf2c93cc9a0c0/tokio/tests/length_delimited.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/length_delimited.rs:4 | #[test]
fn read_single_frame_multi_packet_wait() {
let mut io = FramedRead::new(
mock! {
Ok(b"\x00\x00"[..].into()),
Err(would_block()),
Ok(b"\x00\x09abc"[..].into()),
Err(would_block()),
Ok(b"defghi"[..].into()),
Err(would_block()),
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/length_delimited.rs | MIT | cb4aea394e6851ae8cc45a68beeaf2c93cc9a0c0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/cb4aea394e6851ae8cc45a68beeaf2c93cc9a0c0/tokio/tests/length_delimited.rs | 121 | 180 |
tokio-rs/tokio:tokio/tests/length_delimited.rs:5 | assert_eq!(io.poll().unwrap(), NotReady);
assert_eq!(io.poll().unwrap(), NotReady);
assert_eq!(io.poll().unwrap(), Ready(Some(b"abcdefghi"[..].into())));
assert_eq!(io.poll().unwrap(), NotReady);
assert_eq!(io.poll().unwrap(), NotReady);
assert_eq!(io.poll().unwrap(), Ready(Some(b"123"[..].into())))... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/length_delimited.rs | MIT | cb4aea394e6851ae8cc45a68beeaf2c93cc9a0c0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/cb4aea394e6851ae8cc45a68beeaf2c93cc9a0c0/tokio/tests/length_delimited.rs | 161 | 220 |
tokio-rs/tokio:tokio/tests/length_delimited.rs:6 | fn read_incomplete_payload() {
let mut io = FramedRead::new(
mock! {
Ok(b"\x00\x00\x00\x09ab"[..].into()),
Err(would_block()),
Ok(b"cd"[..].into()),
Err(would_block()),
},
LengthDelimitedCodec::new(),
);
assert_eq!(io.poll().unwrap(), ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/length_delimited.rs | MIT | cb4aea394e6851ae8cc45a68beeaf2c93cc9a0c0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/cb4aea394e6851ae8cc45a68beeaf2c93cc9a0c0/tokio/tests/length_delimited.rs | 201 | 260 |
tokio-rs/tokio:tokio/tests/length_delimited.rs:7 | fn read_update_max_frame_len_in_flight() {
let mut io = length_delimited::Builder::new().new_read(mock! {
Ok(b"\x00\x00\x00\x09abcd"[..].into()),
Err(would_block()),
Ok(b"efghi"[..].into()),
Ok(b"\x00\x00\x00\x09abcdefghi"[..].into()),
});
assert_eq!(io.poll().unwrap(), NotR... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/length_delimited.rs | MIT | cb4aea394e6851ae8cc45a68beeaf2c93cc9a0c0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/cb4aea394e6851ae8cc45a68beeaf2c93cc9a0c0/tokio/tests/length_delimited.rs | 241 | 300 |
tokio-rs/tokio:tokio/tests/length_delimited.rs:8 | fn read_single_multi_frame_one_packet_skip_none_adjusted() {
let mut data: Vec<u8> = vec![];
data.extend_from_slice(b"xx\x00\x09abcdefghi");
data.extend_from_slice(b"yy\x00\x03123");
data.extend_from_slice(b"zz\x00\x0bhello world");
let mut io = length_delimited::Builder::new()
.length_fiel... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/length_delimited.rs | MIT | cb4aea394e6851ae8cc45a68beeaf2c93cc9a0c0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/cb4aea394e6851ae8cc45a68beeaf2c93cc9a0c0/tokio/tests/length_delimited.rs | 281 | 340 |
tokio-rs/tokio:tokio/tests/length_delimited.rs:9 | assert_eq!(io.poll().unwrap(), Ready(Some(b"abcdefghi"[..].into())));
assert_eq!(io.poll().unwrap(), Ready(Some(b"123"[..].into())));
assert_eq!(io.poll().unwrap(), Ready(Some(b"hello world"[..].into())));
assert_eq!(io.poll().unwrap(), Ready(None));
}
#[test]
fn write_single_frame_length_adjusted() {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/length_delimited.rs | MIT | cb4aea394e6851ae8cc45a68beeaf2c93cc9a0c0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/cb4aea394e6851ae8cc45a68beeaf2c93cc9a0c0/tokio/tests/length_delimited.rs | 321 | 380 |
tokio-rs/tokio:tokio/tests/length_delimited.rs:10 | assert!(io.get_ref().calls.is_empty());
}
#[test]
fn write_single_multi_frame_one_packet() {
let mut io = FramedWrite::new(
mock! {
Ok(b"\x00\x00\x00\x09"[..].into()),
Ok(b"abcdefghi"[..].into()),
Ok(b"\x00\x00\x00\x03"[..].into()),
Ok(b"123"[..].into()),
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/length_delimited.rs | MIT | cb4aea394e6851ae8cc45a68beeaf2c93cc9a0c0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/cb4aea394e6851ae8cc45a68beeaf2c93cc9a0c0/tokio/tests/length_delimited.rs | 361 | 420 |
tokio-rs/tokio:tokio/tests/length_delimited.rs:11 | Ok(Flush),
},
LengthDelimitedCodec::new(),
);
assert!(io.start_send(Bytes::from("abcdefghi")).unwrap().is_ready());
assert!(io.poll_complete().unwrap().is_ready());
assert!(io.start_send(Bytes::from("123")).unwrap().is_ready());
assert!(io.poll_complete().unwrap().is_ready());
a... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/length_delimited.rs | MIT | cb4aea394e6851ae8cc45a68beeaf2c93cc9a0c0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/cb4aea394e6851ae8cc45a68beeaf2c93cc9a0c0/tokio/tests/length_delimited.rs | 401 | 460 |
tokio-rs/tokio:tokio/tests/length_delimited.rs:12 | fn write_single_frame_little_endian() {
let mut io = length_delimited::Builder::new()
.little_endian()
.new_write(mock! {
Ok(b"\x09\x00\x00\x00"[..].into()),
Ok(b"abcdefghi"[..].into()),
Ok(Flush),
});
assert!(io.start_send(Bytes::from("abcdefghi")).u... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/length_delimited.rs | MIT | cb4aea394e6851ae8cc45a68beeaf2c93cc9a0c0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/cb4aea394e6851ae8cc45a68beeaf2c93cc9a0c0/tokio/tests/length_delimited.rs | 441 | 500 |
tokio-rs/tokio:tokio/tests/length_delimited.rs:13 | }
#[test]
fn write_update_max_frame_len_at_rest() {
let mut io = length_delimited::Builder::new().new_write(mock! {
Ok(b"\x00\x00\x00\x06"[..].into()),
Ok(b"abcdef"[..].into()),
Ok(Flush),
});
assert!(io.start_send(Bytes::from("abcdef")).unwrap().is_ready());
assert!(io.poll_co... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/length_delimited.rs | MIT | cb4aea394e6851ae8cc45a68beeaf2c93cc9a0c0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/cb4aea394e6851ae8cc45a68beeaf2c93cc9a0c0/tokio/tests/length_delimited.rs | 481 | 540 |
tokio-rs/tokio:tokio/tests/length_delimited.rs:14 | #[test]
fn write_zero() {
let mut io = length_delimited::Builder::new().new_write(mock! {});
assert!(io.start_send(Bytes::from("abcdef")).unwrap().is_ready());
assert_eq!(
io.poll_complete().unwrap_err().kind(),
io::ErrorKind::WriteZero
);
assert!(io.get_ref().calls.is_empty());
}
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/length_delimited.rs | MIT | cb4aea394e6851ae8cc45a68beeaf2c93cc9a0c0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/cb4aea394e6851ae8cc45a68beeaf2c93cc9a0c0/tokio/tests/length_delimited.rs | 521 | 580 |
tokio-rs/tokio:tokio/tests/length_delimited.rs:15 | }
use self::Op::*;
impl io::Read for Mock {
fn read(&mut self, dst: &mut [u8]) -> io::Result<usize> {
match self.calls.pop_front() {
Some(Ok(Op::Data(data))) => {
debug_assert!(dst.len() >= data.len());
dst[..data.len()].copy_from_slice(&data[..]);
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/length_delimited.rs | MIT | cb4aea394e6851ae8cc45a68beeaf2c93cc9a0c0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/cb4aea394e6851ae8cc45a68beeaf2c93cc9a0c0/tokio/tests/length_delimited.rs | 561 | 620 |
tokio-rs/tokio:tokio/tests/length_delimited.rs:16 | Some(Err(e)) => Err(e),
None => Ok(()),
}
}
}
impl AsyncWrite for Mock {
fn shutdown(&mut self) -> Poll<(), io::Error> {
Ok(Ready(()))
}
}
impl<'a> From<&'a [u8]> for Op {
fn from(src: &'a [u8]) -> Op {
Op::Data(src.into())
}
}
impl From<Vec<u8>> for Op {
f... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/length_delimited.rs | MIT | cb4aea394e6851ae8cc45a68beeaf2c93cc9a0c0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/cb4aea394e6851ae8cc45a68beeaf2c93cc9a0c0/tokio/tests/length_delimited.rs | 601 | 623 |
tokio-rs/tokio:tokio/tests/line-frames.rs:1 | #![cfg(feature = "broken")]
#![deny(warnings, rust_2018_idioms)]
use bytes::{BufMut, BytesMut};
use env_logger;
use futures::{Future, Sink, Stream};
use std::io;
use std::net::Shutdown;
use tokio::net::{TcpListener, TcpStream};
use tokio_codec::{Decoder, Encoder};
use tokio_io::io::{read, write_all};
use tokio_threadp... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/line-frames.rs | MIT | 29e417c257c62ae95cfa73f6b56825b3f833dde8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/29e417c257c62ae95cfa73f6b56825b3f833dde8/tokio/tests/line-frames.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/line-frames.rs:2 | fn encode(&mut self, item: BytesMut, into: &mut BytesMut) -> io::Result<()> {
into.put(&item[..]);
Ok(())
}
}
#[test]
fn echo() {
drop(env_logger::try_init());
let pool = Builder::new().pool_size(1).build();
let listener = TcpListener::bind(&"127.0.0.1:0".parse().unwrap()).unwrap();
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/line-frames.rs | MIT | 29e417c257c62ae95cfa73f6b56825b3f833dde8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/29e417c257c62ae95cfa73f6b56825b3f833dde8/tokio/tests/line-frames.rs | 41 | 85 |
tokio-rs/tokio:tokio/tests/line-frames.rs:1 | #![deny(warnings, rust_2018_idioms)]
use bytes::{BufMut, BytesMut};
use env_logger;
use futures::{Future, Sink, Stream};
use std::io;
use std::net::Shutdown;
use tokio::net::{TcpListener, TcpStream};
use tokio_codec::{Decoder, Encoder};
use tokio_io::io::{read, write_all};
use tokio_threadpool::Builder;
pub struct Li... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/line-frames.rs | MIT | cb4aea394e6851ae8cc45a68beeaf2c93cc9a0c0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/cb4aea394e6851ae8cc45a68beeaf2c93cc9a0c0/tokio/tests/line-frames.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/line-frames.rs:2 | into.put(&item[..]);
Ok(())
}
}
#[test]
fn echo() {
drop(env_logger::try_init());
let pool = Builder::new().pool_size(1).build();
let listener = TcpListener::bind(&"127.0.0.1:0".parse().unwrap()).unwrap();
let addr = listener.local_addr().unwrap();
let sender = pool.sender().clone();
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/line-frames.rs | MIT | cb4aea394e6851ae8cc45a68beeaf2c93cc9a0c0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/cb4aea394e6851ae8cc45a68beeaf2c93cc9a0c0/tokio/tests/line-frames.rs | 41 | 84 |
tokio-rs/tokio:tokio/tests/macros_join.rs:1 | #![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 | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_join.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/macros_join.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/macros_join.rs:2 | assert_eq!(foo, (1, 2));
}
#[maybe_tokio_test]
async fn sync_two_lit_expr_no_comma() {
let foo = tokio::join!(async { 1 }, async { 2 });
assert_eq!(foo, (1, 2));
let foo = tokio::join!(biased; async { 1 }, async { 2 });
assert_eq!(foo, (1, 2));
}
#[maybe_tokio_test]
async fn two_await() {
let (tx... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_join.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/macros_join.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/macros_join.rs:3 | let fut = async {
let ready = future::ready(0i32);
tokio::join!(ready)
};
assert_eq!(mem::size_of_val(&fut), 32);
let fut = async {
let ready1 = future::ready(0i32);
let ready2 = future::ready(0i32);
tokio::join!(ready1, ready2)
};
assert_eq!(mem::size_of_val... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_join.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/macros_join.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/macros_join.rs:4 | #[tokio::test]
async fn join_does_not_allow_tasks_to_starve() {
let permits = Arc::new(Semaphore::new(1));
// non_cooperative_task should yield after its budget is exceeded and then poor_little_task should run.
let (non_cooperative_result, little_task_result) = tokio::join!(
non_cooperative_task(Ar... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_join.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/macros_join.rs | 121 | 180 |
tokio-rs/tokio:tokio/tests/macros_join.rs:5 | *poll_order.lock().unwrap()
);
}
#[tokio::test]
async fn futures_are_polled_in_order_in_biased_mode() {
let poll_order = Arc::new(std::sync::Mutex::new(vec![]));
let fut = |x, poll_order: Arc<std::sync::Mutex<Vec<i32>>>| async move {
for _ in 0..4 {
{
let mut guard = po... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_join.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/macros_join.rs | 161 | 220 |
tokio-rs/tokio:tokio/tests/macros_join.rs:6 | let fut = async {
let ready = future::ready(0i32);
tokio::join!(biased; ready)
};
assert_eq!(mem::size_of_val(&fut), 24);
let fut = async {
let ready1 = future::ready(0i32);
let ready2 = future::ready(0i32);
tokio::join!(biased; ready1, ready2)
};
assert_eq!(... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_join.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/macros_join.rs | 201 | 256 |
tokio-rs/tokio:tokio/tests/macros_join.rs:7 | // or variable shadowing.
#[tokio::test]
async fn caller_names_const_count() {
let (tx, rx) = oneshot::channel::<u32>();
const COUNT: u32 = 2;
let mut join = task::spawn(async { tokio::join!(async { tx.send(COUNT).unwrap() }) });
assert_ready!(join.poll());
let res = rx.await.unwrap();
// Th... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_join.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/macros_join.rs | 241 | 256 |
tokio-rs/tokio:tokio/tests/macros_join.rs:6 | let fut = async {
let ready = future::ready(0i32);
tokio::join!(biased; ready)
};
assert_eq!(mem::size_of_val(&fut), 24);
let fut = async {
let ready1 = future::ready(0i32);
let ready2 = future::ready(0i32);
tokio::join!(biased; ready1, ready2)
};
assert_eq!(... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_join.rs | MIT | 8e999e380643160f0e944fd5708de2bd3d1b0d51 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8e999e380643160f0e944fd5708de2bd3d1b0d51/tokio/tests/macros_join.rs | 201 | 236 |
tokio-rs/tokio:tokio/tests/macros_join.rs:1 | #![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 | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_join.rs | MIT | ab53bf0c4727ae63c6a3a3d772b7bd837d2f49c3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ab53bf0c4727ae63c6a3a3d772b7bd837d2f49c3/tokio/tests/macros_join.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/macros_join.rs:2 | assert_eq!(foo, (1, 2));
}
#[maybe_tokio_test]
async fn two_await() {
let (tx1, rx1) = oneshot::channel::<&str>();
let (tx2, rx2) = oneshot::channel::<u32>();
let mut join = task::spawn(async {
tokio::join!(async { rx1.await.unwrap() }, async { rx2.await.unwrap() })
});
assert_pending!(jo... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_join.rs | MIT | ab53bf0c4727ae63c6a3a3d772b7bd837d2f49c3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ab53bf0c4727ae63c6a3a3d772b7bd837d2f49c3/tokio/tests/macros_join.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/macros_join.rs:3 | let ready2 = future::ready(0i32);
tokio::join!(ready1, ready2)
};
assert_eq!(mem::size_of_val(&fut), 48);
}
async fn non_cooperative_task(permits: Arc<Semaphore>) -> usize {
let mut exceeded_budget = 0;
for _ in 0..5 {
// Another task should run after this task uses its whole budget
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_join.rs | MIT | ab53bf0c4727ae63c6a3a3d772b7bd837d2f49c3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ab53bf0c4727ae63c6a3a3d772b7bd837d2f49c3/tokio/tests/macros_join.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/macros_join.rs:4 | );
assert_eq!(5, non_cooperative_result);
assert_eq!(5, little_task_result);
}
#[tokio::test]
async fn a_different_future_is_polled_first_every_time_poll_fn_is_polled() {
let poll_order = Arc::new(std::sync::Mutex::new(vec![]));
let fut = |x, poll_order: Arc<std::sync::Mutex<Vec<i32>>>| async move {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_join.rs | MIT | ab53bf0c4727ae63c6a3a3d772b7bd837d2f49c3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ab53bf0c4727ae63c6a3a3d772b7bd837d2f49c3/tokio/tests/macros_join.rs | 121 | 176 |
tokio-rs/tokio:tokio/tests/macros_join.rs:5 | }
#[tokio::test]
async fn join_into_future() {
struct NotAFuture;
impl std::future::IntoFuture for NotAFuture {
type Output = ();
type IntoFuture = std::future::Ready<()>;
fn into_future(self) -> Self::IntoFuture {
std::future::ready(())
}
}
tokio::join!(No... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_join.rs | MIT | ab53bf0c4727ae63c6a3a3d772b7bd837d2f49c3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ab53bf0c4727ae63c6a3a3d772b7bd837d2f49c3/tokio/tests/macros_join.rs | 161 | 176 |
tokio-rs/tokio:tokio/tests/macros_join.rs:2 | assert_eq!(foo, (1, 2));
}
#[maybe_tokio_test]
async fn two_await() {
let (tx1, rx1) = oneshot::channel::<&str>();
let (tx2, rx2) = oneshot::channel::<u32>();
let mut join = task::spawn(async {
tokio::join!(async { rx1.await.unwrap() }, async { rx2.await.unwrap() })
});
assert_pending!(jo... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_join.rs | MIT | dd1d37167d1f4008ca5d3df500e86826112a8cad | github | async-runtime | https://github.com/tokio-rs/tokio/blob/dd1d37167d1f4008ca5d3df500e86826112a8cad/tokio/tests/macros_join.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/macros_join.rs:3 | let ready2 = future::ready(0i32);
tokio::join!(ready1, ready2)
};
assert_eq!(mem::size_of_val(&fut), 40);
}
async fn non_cooperative_task(permits: Arc<Semaphore>) -> usize {
let mut exceeded_budget = 0;
for _ in 0..5 {
// Another task should run after this task uses its whole budget
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_join.rs | MIT | dd1d37167d1f4008ca5d3df500e86826112a8cad | github | async-runtime | https://github.com/tokio-rs/tokio/blob/dd1d37167d1f4008ca5d3df500e86826112a8cad/tokio/tests/macros_join.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/macros_join.rs:4 | );
assert_eq!(5, non_cooperative_result);
assert_eq!(5, little_task_result);
}
#[tokio::test]
async fn a_different_future_is_polled_first_every_time_poll_fn_is_polled() {
let poll_order = Arc::new(std::sync::Mutex::new(vec![]));
let fut = |x, poll_order: Arc<std::sync::Mutex<Vec<i32>>>| async move {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_join.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/macros_join.rs | 121 | 161 |
tokio-rs/tokio:tokio/tests/macros_join.rs:1 | #![cfg(feature = "macros")]
#![allow(clippy::disallowed_names)]
use std::sync::Arc;
#[cfg(tokio_wasm_not_wasi)]
#[cfg(target_pointer_width = "64")]
use wasm_bindgen_test::wasm_bindgen_test as test;
#[cfg(tokio_wasm_not_wasi)]
use wasm_bindgen_test::wasm_bindgen_test as maybe_tokio_test;
#[cfg(not(tokio_wasm_not_wasi)... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_join.rs | MIT | ca9f7ee9f4750d6bb8a073ab4df1b7e4555857ad | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ca9f7ee9f4750d6bb8a073ab4df1b7e4555857ad/tokio/tests/macros_join.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/macros_join.rs:4 | );
assert_eq!(5, non_cooperative_result);
assert_eq!(5, little_task_result);
}
#[tokio::test]
async fn a_different_future_is_polled_first_every_time_poll_fn_is_polled() {
let poll_order = Arc::new(std::sync::Mutex::new(vec![]));
let fut = |x, poll_order: Arc<std::sync::Mutex<Vec<i32>>>| async move {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_join.rs | MIT | 22cff80048c62ed0fa20065888667d00d5aedd14 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/22cff80048c62ed0fa20065888667d00d5aedd14/tokio/tests/macros_join.rs | 121 | 155 |
tokio-rs/tokio:tokio/tests/macros_join.rs:1 | #![cfg(feature = "macros")]
#![allow(clippy::blacklisted_name)]
use std::sync::Arc;
#[cfg(tokio_wasm_not_wasi)]
#[cfg(target_pointer_width = "64")]
use wasm_bindgen_test::wasm_bindgen_test as test;
#[cfg(tokio_wasm_not_wasi)]
use wasm_bindgen_test::wasm_bindgen_test as maybe_tokio_test;
#[cfg(not(tokio_wasm_not_wasi)... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_join.rs | MIT | df6348fb4a8d9d34d241ab7275688e1ab489383c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/df6348fb4a8d9d34d241ab7275688e1ab489383c/tokio/tests/macros_join.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/macros_join.rs:1 | #![cfg(feature = "macros")]
#![allow(clippy::blacklisted_name)]
use std::sync::Arc;
#[cfg(tokio_wasm_not_wasi)]
use wasm_bindgen_test::wasm_bindgen_test as test;
#[cfg(tokio_wasm_not_wasi)]
use wasm_bindgen_test::wasm_bindgen_test as maybe_tokio_test;
#[cfg(not(tokio_wasm_not_wasi))]
use tokio::test as maybe_tokio_te... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_join.rs | MIT | b2ada60e701d5c9e6644cf8fc42a100774f8e23f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/tests/macros_join.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/macros_join.rs:2 | assert_eq!(foo, (1, 2));
}
#[maybe_tokio_test]
async fn two_await() {
let (tx1, rx1) = oneshot::channel::<&str>();
let (tx2, rx2) = oneshot::channel::<u32>();
let mut join = task::spawn(async {
tokio::join!(async { rx1.await.unwrap() }, async { rx2.await.unwrap() })
});
assert_pending!(jo... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_join.rs | MIT | b2ada60e701d5c9e6644cf8fc42a100774f8e23f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/tests/macros_join.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/macros_join.rs:3 | };
assert_eq!(mem::size_of_val(&fut), 32);
}
async fn non_cooperative_task(permits: Arc<Semaphore>) -> usize {
let mut exceeded_budget = 0;
for _ in 0..5 {
// Another task should run after this task uses its whole budget
for _ in 0..128 {
let _permit = permits.clone().acquire_o... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_join.rs | MIT | b2ada60e701d5c9e6644cf8fc42a100774f8e23f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/tests/macros_join.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/macros_join.rs:4 | assert_eq!(5, non_cooperative_result);
assert_eq!(5, little_task_result);
}
#[tokio::test]
async fn a_different_future_is_polled_first_every_time_poll_fn_is_polled() {
let poll_order = Arc::new(std::sync::Mutex::new(vec![]));
let fut = |x, poll_order: Arc<std::sync::Mutex<Vec<i32>>>| async move {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_join.rs | MIT | b2ada60e701d5c9e6644cf8fc42a100774f8e23f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/tests/macros_join.rs | 121 | 153 |
tokio-rs/tokio:tokio/tests/macros_join.rs:1 | #![cfg(feature = "macros")]
#![allow(clippy::blacklisted_name)]
use std::sync::Arc;
#[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;
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_join.rs | MIT | 0dc62da21b0bffe113e2efa23f6da6ef4e36bf4f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0dc62da21b0bffe113e2efa23f6da6ef4e36bf4f/tokio/tests/macros_join.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/macros_join.rs:1 | #![cfg(feature = "macros")]
#![allow(clippy::blacklisted_name)]
use std::sync::Arc;
#[cfg(all(target_arch = "wasm32", not(target_os = "wasi")))]
use wasm_bindgen_test::wasm_bindgen_test as test;
#[cfg(all(target_arch = "wasm32", not(target_os = "wasi")))]
use wasm_bindgen_test::wasm_bindgen_test as maybe_tokio_test;
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_join.rs | MIT | f3e340a35b306e926e78537a0dd65b2e9b9cdc89 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f3e340a35b306e926e78537a0dd65b2e9b9cdc89/tokio/tests/macros_join.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/macros_join.rs:2 | assert_eq!(foo, (1, 2));
}
#[maybe_tokio_test]
async fn two_await() {
let (tx1, rx1) = oneshot::channel::<&str>();
let (tx2, rx2) = oneshot::channel::<u32>();
let mut join = task::spawn(async {
tokio::join!(async { rx1.await.unwrap() }, async { rx2.await.unwrap() })
});
assert_pending!(jo... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_join.rs | MIT | 6d3f92dddc510e9276191cfab1b0432ce8248589 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6d3f92dddc510e9276191cfab1b0432ce8248589/tokio/tests/macros_join.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/macros_join.rs:3 | };
assert_eq!(mem::size_of_val(&fut), 32);
}
async fn non_cooperative_task(permits: Arc<Semaphore>) -> usize {
let mut exceeded_budget = 0;
for _ in 0..5 {
// Another task should run after after this task uses its whole budget
for _ in 0..128 {
let _permit = permits.clone().acq... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_join.rs | MIT | 6d3f92dddc510e9276191cfab1b0432ce8248589 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6d3f92dddc510e9276191cfab1b0432ce8248589/tokio/tests/macros_join.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/macros_join.rs:1 | #![cfg(feature = "macros")]
#![allow(clippy::blacklisted_name)]
use std::sync::Arc;
#[cfg(target_arch = "wasm32")]
use wasm_bindgen_test::wasm_bindgen_test as test;
#[cfg(target_arch = "wasm32")]
use wasm_bindgen_test::wasm_bindgen_test as maybe_tokio_test;
#[cfg(not(target_arch = "wasm32"))]
use tokio::test as maybe... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_join.rs | MIT | 1872a425e2b56530b46d44baf7bb45c1ee503807 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1872a425e2b56530b46d44baf7bb45c1ee503807/tokio/tests/macros_join.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/macros_join.rs:1 | #![cfg(feature = "macros")]
#![allow(clippy::blacklisted_name)]
#[cfg(target_arch = "wasm32")]
use wasm_bindgen_test::wasm_bindgen_test as test;
#[cfg(target_arch = "wasm32")]
use wasm_bindgen_test::wasm_bindgen_test as maybe_tokio_test;
#[cfg(not(target_arch = "wasm32"))]
use tokio::test as maybe_tokio_test;
use to... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_join.rs | MIT | 2747043f6f7e0870cc5aa72c146dfae9543c5ba8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2747043f6f7e0870cc5aa72c146dfae9543c5ba8/tokio/tests/macros_join.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/macros_join.rs:2 | }
#[maybe_tokio_test]
async fn two_await() {
let (tx1, rx1) = oneshot::channel::<&str>();
let (tx2, rx2) = oneshot::channel::<u32>();
let mut join = task::spawn(async {
tokio::join!(async { rx1.await.unwrap() }, async { rx2.await.unwrap() })
});
assert_pending!(join.poll());
tx2.send... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_join.rs | MIT | 2747043f6f7e0870cc5aa72c146dfae9543c5ba8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2747043f6f7e0870cc5aa72c146dfae9543c5ba8/tokio/tests/macros_join.rs | 41 | 82 |
tokio-rs/tokio:tokio/tests/macros_join.rs:1 | #![allow(clippy::blacklisted_name)]
use tokio::sync::oneshot;
use tokio_test::{assert_pending, assert_ready, task};
#[tokio::test]
async fn sync_one_lit_expr_comma() {
let foo = tokio::join!(async { 1 },);
assert_eq!(foo, (1,));
}
#[tokio::test]
async fn sync_one_lit_expr_no_comma() {
let foo = tokio::jo... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_join.rs | MIT | 9264b837d897dcdf974703a6739132b995e669bc | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9264b837d897dcdf974703a6739132b995e669bc/tokio/tests/macros_join.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/macros_join.rs:2 | assert_pending!(join.poll());
tx2.send(123).unwrap();
assert!(join.is_woken());
assert_pending!(join.poll());
tx1.send("hello").unwrap();
assert!(join.is_woken());
let res = assert_ready!(join.poll());
assert_eq!(("hello", 123), res);
}
#[test]
fn join_size() {
use futures::future;
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_join.rs | MIT | 9264b837d897dcdf974703a6739132b995e669bc | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9264b837d897dcdf974703a6739132b995e669bc/tokio/tests/macros_join.rs | 41 | 72 |
tokio-rs/tokio:tokio/tests/macros_join.rs:1 | use tokio::sync::oneshot;
use tokio_test::{assert_pending, assert_ready, task};
#[tokio::test]
async fn sync_one_lit_expr_comma() {
let foo = tokio::join!(async { 1 },);
assert_eq!(foo, (1,));
}
#[tokio::test]
async fn sync_one_lit_expr_no_comma() {
let foo = tokio::join!(async { 1 });
assert_eq!(fo... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_join.rs | MIT | 5bf06f2b5a81ae7b5b8adfe4a44fab033f4156cf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/5bf06f2b5a81ae7b5b8adfe4a44fab033f4156cf/tokio/tests/macros_join.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/macros_join.rs:1 | use tokio::sync::oneshot;
use tokio_test::{assert_pending, assert_ready, task};
#[tokio::test]
async fn sync_one_lit_expr_comma() {
let foo = tokio::join!(async { 1 },);
assert_eq!(foo, (1,));
}
#[tokio::test]
async fn sync_one_lit_expr_no_comma() {
let foo = tokio::join!(async { 1 });
assert_eq!(fo... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_join.rs | MIT | 7079bcd60975f592e08fcd575991f6ae2a409a1f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7079bcd60975f592e08fcd575991f6ae2a409a1f/tokio/tests/macros_join.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/macros_pin.rs:1 | #![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 | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_pin.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/macros_pin.rs | 1 | 21 |
tokio-rs/tokio:tokio/tests/macros_pin.rs:1 | #![cfg(feature = "macros")]
#[cfg(tokio_wasm_not_wasi)]
use wasm_bindgen_test::wasm_bindgen_test as maybe_tokio_test;
#[cfg(not(tokio_wasm_not_wasi))]
use tokio::test as maybe_tokio_test;
async fn one() {}
async fn two() {}
#[maybe_tokio_test]
async fn multi_pin() {
tokio::pin! {
let f1 = one();
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_pin.rs | MIT | b2ada60e701d5c9e6644cf8fc42a100774f8e23f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/tests/macros_pin.rs | 1 | 21 |
tokio-rs/tokio:tokio/tests/macros_pin.rs:1 | #![cfg(feature = "macros")]
#[cfg(all(target_arch = "wasm32", not(target_os = "wasi")))]
use wasm_bindgen_test::wasm_bindgen_test as maybe_tokio_test;
#[cfg(not(all(target_arch = "wasm32", not(target_os = "wasi"))))]
use tokio::test as maybe_tokio_test;
async fn one() {}
async fn two() {}
#[maybe_tokio_test]
async ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_pin.rs | MIT | 6d3f92dddc510e9276191cfab1b0432ce8248589 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6d3f92dddc510e9276191cfab1b0432ce8248589/tokio/tests/macros_pin.rs | 1 | 21 |
tokio-rs/tokio:tokio/tests/macros_pin.rs:1 | #![cfg(feature = "macros")]
#[cfg(target_arch = "wasm32")]
use wasm_bindgen_test::wasm_bindgen_test as maybe_tokio_test;
#[cfg(not(target_arch = "wasm32"))]
use tokio::test as maybe_tokio_test;
async fn one() {}
async fn two() {}
#[maybe_tokio_test]
async fn multi_pin() {
tokio::pin! {
let f1 = one();
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_pin.rs | MIT | 2747043f6f7e0870cc5aa72c146dfae9543c5ba8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2747043f6f7e0870cc5aa72c146dfae9543c5ba8/tokio/tests/macros_pin.rs | 1 | 21 |
tokio-rs/tokio:tokio/tests/macros_pin.rs:1 | async fn one() {}
async fn two() {}
#[tokio::test]
async fn multi_pin() {
tokio::pin! {
let f1 = one();
let f2 = two();
}
(&mut f1).await;
(&mut f2).await;
} | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_pin.rs | MIT | 937ae11f37b0acf6cff9f5808b050f5b8c6ec976 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/937ae11f37b0acf6cff9f5808b050f5b8c6ec976/tokio/tests/macros_pin.rs | 1 | 13 |
tokio-rs/tokio:tokio/tests/macros_pin.rs:1 | use tokio::pin;
async fn one() {}
async fn two() {}
#[tokio::test]
async fn multi_pin() {
pin! {
let f1 = one();
let f2 = two();
}
(&mut f1).await;
(&mut f2).await;
} | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_pin.rs | MIT | 1dadc701c04879f1df4ddaa0df362297a144d7b3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1dadc701c04879f1df4ddaa0df362297a144d7b3/tokio/tests/macros_pin.rs | 1 | 15 |
tokio-rs/tokio:tokio/tests/macros_rename_test.rs:1 | #![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 | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_rename_test.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/macros_rename_test.rs | 1 | 35 |
tokio-rs/tokio:tokio/tests/macros_rename_test.rs:1 | #![cfg(all(feature = "full", not(tokio_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 = "tokio1")]
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_rename_test.rs | MIT | 17cc283f58906bb34d6446331f6f3dbd14fd319e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/17cc283f58906bb34d6446331f6f3dbd14fd319e/tokio/tests/macros_rename_test.rs | 1 | 35 |
tokio-rs/tokio:tokio/tests/macros_rename_test.rs:1 | #![cfg(all(feature = "full", not(tokio_wasi)))] // Wasi doesn't support threading
#[allow(unused_imports)]
use std as tokio;
use ::tokio as tokio1;
async fn compute() -> usize {
let join = tokio1::spawn(async { 1 });
join.await.unwrap()
}
#[tokio1::main(crate = "tokio1")]
async fn compute_main() -> usize {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_rename_test.rs | MIT | b2ada60e701d5c9e6644cf8fc42a100774f8e23f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/tests/macros_rename_test.rs | 1 | 26 |
tokio-rs/tokio:tokio/tests/macros_rename_test.rs:1 | #![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi doesn't support threading
#[allow(unused_imports)]
use std as tokio;
use ::tokio as tokio1;
async fn compute() -> usize {
let join = tokio1::spawn(async { 1 });
join.await.unwrap()
}
#[tokio1::main(crate = "tokio1")]
async fn compute_main() -> ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_rename_test.rs | MIT | 6d3f92dddc510e9276191cfab1b0432ce8248589 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6d3f92dddc510e9276191cfab1b0432ce8248589/tokio/tests/macros_rename_test.rs | 1 | 26 |
tokio-rs/tokio:tokio/tests/macros_rename_test.rs:1 | #![cfg(feature = "full")]
#[allow(unused_imports)]
use std as tokio;
use ::tokio as tokio1;
async fn compute() -> usize {
let join = tokio1::spawn(async { 1 });
join.await.unwrap()
}
#[tokio1::main(crate = "tokio1")]
async fn compute_main() -> usize {
compute().await
}
#[test]
fn crate_rename_main() {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_rename_test.rs | MIT | d590a369d5b7e629ca76af974d8aa5b48236b49b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d590a369d5b7e629ca76af974d8aa5b48236b49b/tokio/tests/macros_rename_test.rs | 1 | 26 |
tokio-rs/tokio:tokio/tests/macros_select.rs:1 | #![cfg(feature = "macros")]
#![allow(clippy::disallowed_names)]
#[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;
use tokio::sync::oneshot;
u... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/macros_select.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/macros_select.rs:2 | assert_eq!(foo, 1);
}
#[maybe_tokio_test]
async fn nested_one() {
let foo = tokio::select! {
foo = async { 1 } => tokio::select! {
bar = async { foo } => bar,
},
};
assert_eq!(foo, 1);
}
#[maybe_tokio_test]
async fn sync_one_lit_expr_no_comma() {
let foo = tokio::select! {... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/macros_select.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/macros_select.rs:3 | #[maybe_tokio_test]
async fn sync_one_ident() {
let one = one();
let foo = tokio::select! {
foo = one => foo,
};
assert_eq!(foo, 1);
}
#[maybe_tokio_test]
async fn sync_two() {
use std::cell::Cell;
let cnt = Cell::new(0);
let res = tokio::select! {
foo = async {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/macros_select.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/macros_select.rs:4 | drop(s);
v
} => foo
};
assert_eq!(res, 1);
}
#[maybe_tokio_test]
#[cfg(feature = "full")]
async fn one_ready() {
let (tx1, rx1) = oneshot::channel::<i32>();
let (_tx2, rx2) = oneshot::channel::<i32>();
tx1.send(1).unwrap();
let v = tokio::select! {
res = rx1 => {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/macros_select.rs | 121 | 180 |
tokio-rs/tokio:tokio/tests/macros_select.rs:5 | assert_ok!(tx2.send(3));
tokio::task::yield_now().await;
drop((tx1, tx2));
});
let mut rem = true;
let mut msgs = vec![];
while rem {
tokio::select! {
Some(x) = rx1.recv() => {
msgs.push(x);
}
Some(y) = rx2.recv() => {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/macros_select.rs | 161 | 220 |
tokio-rs/tokio:tokio/tests/macros_select.rs:6 | assert_eq!(1, assert_ok!(res));
assert_eq!(2, assert_ok!(rx2.await));
ran = true;
},
res = &mut rx2 => {
assert_eq!(2, assert_ok!(res));
assert_eq!(1, assert_ok!(rx1.await));
ran = true;
},
}
assert!(ran);
}
#[maybe_tokio_test... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/macros_select.rs | 201 | 260 |
tokio-rs/tokio:tokio/tests/macros_select.rs:7 | }
};
assert_eq!(mem::size_of_val(&fut), 32);
}
#[maybe_tokio_test]
async fn struct_size_2() {
let fut = async {
let ready1 = future::ready(0i32);
let ready2 = future::ready(0i32);
tokio::select! {
_ = ready1 => {},
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/macros_select.rs | 241 | 300 |
tokio-rs/tokio:tokio/tests/macros_select.rs:8 | async fn mutable_borrowing_future_with_same_borrow_in_block() {
let mut value = 234;
tokio::select! {
_ = require_mutable(&mut value) => { },
_ = async_noop() => {
value += 5;
},
}
assert!(value >= 234);
}
#[maybe_tokio_test]
async fn mutable_borrowing_future_with_... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/macros_select.rs | 281 | 340 |
tokio-rs/tokio:tokio/tests/macros_select.rs:9 | polled = true;
Ready(None::<()>)
});
let mut f = task::spawn(async {
tokio::select! {
Some(_) = f => unreachable!(),
ret = rx => ret.unwrap(),
}
});
assert_pending!(f.poll());
assert_pending!(f.poll());
assert_ok!(tx.send(1));
let res = ass... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/macros_select.rs | 321 | 380 |
tokio-rs/tokio:tokio/tests/macros_select.rs:10 | }
#[maybe_tokio_test]
async fn join_with_select() {
use tokio_test::task;
let (tx1, mut rx1) = oneshot::channel();
let (tx2, mut rx2) = oneshot::channel();
let mut f = task::spawn(async {
let mut a = None;
let mut b = None;
while a.is_none() || b.is_none() {
tokio... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/macros_select.rs | 361 | 420 |
tokio-rs/tokio:tokio/tests/macros_select.rs:11 | use tokio::time::{self, Duration};
tokio::select! {
_ = time::sleep(Duration::from_millis(10)), if false => {
panic!("if condition ignored")
}
_ = async { 1u32 } => {
}
}
}
#[tokio::test]
#[cfg(feature = "full")]
async fn use_future_in_if_condition_biased() {
us... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/macros_select.rs | 401 | 460 |
tokio-rs/tokio:tokio/tests/macros_select.rs:12 | x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/macros_select.rs | 441 | 500 |
tokio-rs/tokio:tokio/tests/macros_select.rs:13 | x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/macros_select.rs | 481 | 540 |
tokio-rs/tokio:tokio/tests/macros_select.rs:14 | async fn mut_on_left_hand_side() {
let v = async move {
let ok = async { 1 };
tokio::pin!(ok);
tokio::select! {
mut a = &mut ok => {
a += 1;
a
}
}
}
.await;
assert_eq!(v, 2);
}
#[maybe_tokio_test]
async fn biased_on... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/macros_select.rs | 521 | 580 |
tokio-rs/tokio:tokio/tests/macros_select.rs:15 | #[cfg(feature = "full")]
async fn biased_eventually_ready() {
use tokio::task::yield_now;
let one = async {};
let two = async { yield_now().await };
let three = async { yield_now().await };
let mut count = 0u8;
tokio::pin!(one, two, three);
loop {
tokio::select! {
bia... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/macros_select.rs | 561 | 620 |
tokio-rs/tokio:tokio/tests/macros_select.rs:16 | _ = async {} => (),
else => (),
}
}
// https://github.com/tokio-rs/tokio/issues/4182
#[maybe_tokio_test]
async fn mut_ref_patterns() {
tokio::select! {
Some(mut foo) = async { Some("1".to_string()) } => {
assert_eq!(foo, "1");
foo = "2".to_string();
assert_eq... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/macros_select.rs | 601 | 660 |
tokio-rs/tokio:tokio/tests/macros_select.rs:17 | .build()
.unwrap();
let rt1_values = rt1.block_on(async { (select_0_to_9().await, select_0_to_9().await) });
let rt2 = tokio::runtime::Builder::new_current_thread()
.rng_seed(RngSeed::from_bytes(seed))
.build()
.unwrap();
let rt2_values = rt2.bloc... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/macros_select.rs | 641 | 700 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.