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/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,
};
assert_eq!(1, nu... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 94ee305741eb21a46fce832ff3683f886da76fec | github | async-runtime | https://github.com/tokio-rs/tokio/blob/94ee305741eb21a46fce832ff3683f886da76fec/tokio/tests/macros_select.rs | 441 | 500 |
tokio-rs/tokio:tokio/tests/macros_select.rs:13 | tokio::pin!(ok);
tokio::select! {
mut a = &mut ok => {
a += 1;
a
}
}
}
.await;
assert_eq!(v, 2);
}
#[tokio::test]
async fn biased_one_not_ready() {
let (_tx1, rx1) = oneshot::channel::<i32>();
let (tx2, rx2) = oneshot::channel:... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 94ee305741eb21a46fce832ff3683f886da76fec | github | async-runtime | https://github.com/tokio-rs/tokio/blob/94ee305741eb21a46fce832ff3683f886da76fec/tokio/tests/macros_select.rs | 481 | 540 |
tokio-rs/tokio:tokio/tests/macros_select.rs:14 | 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! {
biased;
_ = &mut two, if count < 2 => {
count += 1;
asser... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 94ee305741eb21a46fce832ff3683f886da76fec | github | async-runtime | https://github.com/tokio-rs/tokio/blob/94ee305741eb21a46fce832ff3683f886da76fec/tokio/tests/macros_select.rs | 521 | 580 |
tokio-rs/tokio:tokio/tests/macros_select.rs:15 | // https://github.com/tokio-rs/tokio/issues/4182
#[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!(foo, "2");
},
};
tokio::select! {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 94ee305741eb21a46fce832ff3683f886da76fec | github | async-runtime | https://github.com/tokio-rs/tokio/blob/94ee305741eb21a46fce832ff3683f886da76fec/tokio/tests/macros_select.rs | 561 | 586 |
tokio-rs/tokio:tokio/tests/macros_select.rs:14 | 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! {
biased;
_ = &mut two, if count < 2 => {
count += 1;
asser... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 0d9430b99cc699824cc8545afbb01e0a7c520428 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0d9430b99cc699824cc8545afbb01e0a7c520428/tokio/tests/macros_select.rs | 521 | 560 |
tokio-rs/tokio:tokio/tests/macros_select.rs:9 | }
#[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::sel... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | e3851089207f6617dfcc0c7a73013eb819a0bfe0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e3851089207f6617dfcc0c7a73013eb819a0bfe0/tokio/tests/macros_select.rs | 321 | 380 |
tokio-rs/tokio:tokio/tests/macros_select.rs:10 | tokio::select! {
_ = time::sleep(Duration::from_millis(50)), if false => {
panic!("if condition ignored")
}
_ = async { 1u32 } => {
}
}
}
#[tokio::test]
async fn many_branches() {
let num = tokio::select! {
x = async { 1 } => x,
x = async { 1 } => x,
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | e3851089207f6617dfcc0c7a73013eb819a0bfe0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e3851089207f6617dfcc0c7a73013eb819a0bfe0/tokio/tests/macros_select.rs | 361 | 420 |
tokio-rs/tokio:tokio/tests/macros_select.rs:11 | 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 | e3851089207f6617dfcc0c7a73013eb819a0bfe0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e3851089207f6617dfcc0c7a73013eb819a0bfe0/tokio/tests/macros_select.rs | 401 | 460 |
tokio-rs/tokio:tokio/tests/macros_select.rs:12 | #[tokio::test]
async fn never_branch_no_warnings() {
let t = tokio::select! {
_ = async_never() => 0,
one_async_ready = one() => one_async_ready,
};
assert_eq!(t, 1);
}
async fn one() -> usize {
1
}
async fn require_mutable(_: &mut i32) {}
async fn async_noop() {}
async fn async_never... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | e3851089207f6617dfcc0c7a73013eb819a0bfe0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e3851089207f6617dfcc0c7a73013eb819a0bfe0/tokio/tests/macros_select.rs | 441 | 500 |
tokio-rs/tokio:tokio/tests/macros_select.rs:13 | #[tokio::test]
async fn biased_one_not_ready() {
let (_tx1, rx1) = oneshot::channel::<i32>();
let (tx2, rx2) = oneshot::channel::<i32>();
let (tx3, rx3) = oneshot::channel::<i32>();
tx2.send(2).unwrap();
tx3.send(3).unwrap();
let v = tokio::select! {
biased;
_ = rx1 => unreach... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | e3851089207f6617dfcc0c7a73013eb819a0bfe0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e3851089207f6617dfcc0c7a73013eb819a0bfe0/tokio/tests/macros_select.rs | 481 | 539 |
tokio-rs/tokio:tokio/tests/macros_select.rs:14 | _ = &mut two, if count < 2 => {
count += 1;
assert_eq!(count, 2);
}
_ = &mut three, if count < 3 => {
count += 1;
assert_eq!(count, 3);
}
_ = &mut one, if count < 1 => {
count += 1;
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | e3851089207f6617dfcc0c7a73013eb819a0bfe0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e3851089207f6617dfcc0c7a73013eb819a0bfe0/tokio/tests/macros_select.rs | 521 | 539 |
tokio-rs/tokio:tokio/tests/macros_select.rs:14 | _ = &mut two, if count < 2 => {
count += 1;
assert_eq!(count, 2);
}
_ = &mut three, if count < 3 => {
count += 1;
assert_eq!(count, 3);
}
_ = &mut one, if count < 1 => {
count += 1;
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 9d8b37d51a7d0cdf5a0fbf754240c929fb69e9f2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9d8b37d51a7d0cdf5a0fbf754240c929fb69e9f2/tokio/tests/macros_select.rs | 521 | 549 |
tokio-rs/tokio:tokio/tests/macros_select.rs:9 | }
#[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::sel... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | b75d02a2b6f3062567856dca22695d8bfa364c10 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b75d02a2b6f3062567856dca22695d8bfa364c10/tokio/tests/macros_select.rs | 321 | 380 |
tokio-rs/tokio:tokio/tests/macros_select.rs:10 | let sleep = time::sleep(Duration::from_millis(50));
tokio::pin!(sleep);
tokio::select! {
_ = time::sleep(Duration::from_millis(50)), if false => {
panic!("if condition ignored")
}
_ = async { 1u32 } => {
}
}
}
#[tokio::test]
async fn many_branches() {
let nu... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | b75d02a2b6f3062567856dca22695d8bfa364c10 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b75d02a2b6f3062567856dca22695d8bfa364c10/tokio/tests/macros_select.rs | 361 | 420 |
tokio-rs/tokio:tokio/tests/macros_select.rs:11 | 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 | b75d02a2b6f3062567856dca22695d8bfa364c10 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b75d02a2b6f3062567856dca22695d8bfa364c10/tokio/tests/macros_select.rs | 401 | 460 |
tokio-rs/tokio:tokio/tests/macros_select.rs:12 | assert_eq!(1, num);
}
#[tokio::test]
async fn never_branch_no_warnings() {
let t = tokio::select! {
_ = async_never() => 0,
one_async_ready = one() => one_async_ready,
};
assert_eq!(t, 1);
}
async fn one() -> usize {
1
}
async fn require_mutable(_: &mut i32) {}
async fn async_noop() {... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | b75d02a2b6f3062567856dca22695d8bfa364c10 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b75d02a2b6f3062567856dca22695d8bfa364c10/tokio/tests/macros_select.rs | 441 | 500 |
tokio-rs/tokio:tokio/tests/macros_select.rs:13 | .await;
assert_eq!(v, 2);
}
#[tokio::test]
async fn biased_one_not_ready() {
let (_tx1, rx1) = oneshot::channel::<i32>();
let (tx2, rx2) = oneshot::channel::<i32>();
let (tx3, rx3) = oneshot::channel::<i32>();
tx2.send(2).unwrap();
tx3.send(3).unwrap();
let v = tokio::select! {
bi... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | b75d02a2b6f3062567856dca22695d8bfa364c10 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b75d02a2b6f3062567856dca22695d8bfa364c10/tokio/tests/macros_select.rs | 481 | 540 |
tokio-rs/tokio:tokio/tests/macros_select.rs:14 | loop {
tokio::select! {
biased;
_ = &mut two, if count < 2 => {
count += 1;
assert_eq!(count, 2);
}
_ = &mut three, if count < 3 => {
count += 1;
assert_eq!(count, 3);
}
_ = &... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | b75d02a2b6f3062567856dca22695d8bfa364c10 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b75d02a2b6f3062567856dca22695d8bfa364c10/tokio/tests/macros_select.rs | 521 | 542 |
tokio-rs/tokio:tokio/tests/macros_select.rs:12 | assert_eq!(1, num);
}
#[tokio::test]
async fn never_branch_no_warnings() {
let t = tokio::select! {
_ = async_never() => 0,
one_async_ready = one() => one_async_ready,
};
assert_eq!(t, 1);
}
async fn one() -> usize {
1
}
async fn require_mutable(_: &mut i32) {}
async fn async_noop() {... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | ae67851f11b7cc1f577de8ce21767ce3e2c7aff9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ae67851f11b7cc1f577de8ce21767ce3e2c7aff9/tokio/tests/macros_select.rs | 441 | 483 |
tokio-rs/tokio:tokio/tests/macros_select.rs:9 | }
#[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::sel... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 60d81bbe10faf344ea18438a1c5ecb9173e6ec52 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/60d81bbe10faf344ea18438a1c5ecb9173e6ec52/tokio/tests/macros_select.rs | 321 | 380 |
tokio-rs/tokio:tokio/tests/macros_select.rs:10 | let mut sleep = time::sleep(Duration::from_millis(50));
tokio::select! {
_ = &mut sleep, if !sleep.is_elapsed() => {
}
_ = async { 1 } => {
}
}
}
#[tokio::test]
async fn many_branches() {
let num = tokio::select! {
x = async { 1 } => x,
x = async { 1 } => x,... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 60d81bbe10faf344ea18438a1c5ecb9173e6ec52 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/60d81bbe10faf344ea18438a1c5ecb9173e6ec52/tokio/tests/macros_select.rs | 361 | 420 |
tokio-rs/tokio:tokio/tests/macros_select.rs:11 | 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 | 60d81bbe10faf344ea18438a1c5ecb9173e6ec52 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/60d81bbe10faf344ea18438a1c5ecb9173e6ec52/tokio/tests/macros_select.rs | 401 | 460 |
tokio-rs/tokio:tokio/tests/macros_select.rs:12 | }
#[tokio::test]
async fn never_branch_no_warnings() {
let t = tokio::select! {
_ = async_never() => 0,
one_async_ready = one() => one_async_ready,
};
assert_eq!(t, 1);
}
async fn one() -> usize {
1
}
async fn require_mutable(_: &mut i32) {}
async fn async_noop() {}
async fn async_ne... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 60d81bbe10faf344ea18438a1c5ecb9173e6ec52 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/60d81bbe10faf344ea18438a1c5ecb9173e6ec52/tokio/tests/macros_select.rs | 441 | 481 |
tokio-rs/tokio:tokio/tests/macros_select.rs:9 | }
#[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::sel... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | b704c53b9cc76eaf8c9c6585f8444c4515d27728 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b704c53b9cc76eaf8c9c6585f8444c4515d27728/tokio/tests/macros_select.rs | 321 | 380 |
tokio-rs/tokio:tokio/tests/macros_select.rs:10 | let mut delay = time::sleep(Duration::from_millis(50));
tokio::select! {
_ = &mut delay, if !delay.is_elapsed() => {
}
_ = async { 1 } => {
}
}
}
#[tokio::test]
async fn many_branches() {
let num = tokio::select! {
x = async { 1 } => x,
x = async { 1 } => x,... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | b704c53b9cc76eaf8c9c6585f8444c4515d27728 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b704c53b9cc76eaf8c9c6585f8444c4515d27728/tokio/tests/macros_select.rs | 361 | 420 |
tokio-rs/tokio:tokio/tests/macros_select.rs:4 | async fn select_streams() {
let (tx1, mut rx1) = mpsc::unbounded_channel::<i32>();
let (tx2, mut rx2) = mpsc::unbounded_channel::<i32>();
tokio::spawn(async move {
assert_ok!(tx2.send(1));
task::yield_now().await;
assert_ok!(tx1.send(2));
task::yield_now().await;
a... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 53ccfc1fd694ee70c7a4d1e7af09a856bafb49e5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/53ccfc1fd694ee70c7a4d1e7af09a856bafb49e5/tokio/tests/macros_select.rs | 121 | 180 |
tokio-rs/tokio:tokio/tests/macros_select.rs:9 | }
#[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::sel... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | e09b90ea32385337170ce17eb55ab372f9388af5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e09b90ea32385337170ce17eb55ab372f9388af5/tokio/tests/macros_select.rs | 321 | 380 |
tokio-rs/tokio:tokio/tests/macros_select.rs:10 | let mut delay = time::delay_for(Duration::from_millis(50));
tokio::select! {
_ = &mut delay, if !delay.is_elapsed() => {
}
_ = async { 1 } => {
}
}
}
#[tokio::test]
async fn many_branches() {
let num = tokio::select! {
x = async { 1 } => x,
x = async { 1 } =... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | e09b90ea32385337170ce17eb55ab372f9388af5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e09b90ea32385337170ce17eb55ab372f9388af5/tokio/tests/macros_select.rs | 361 | 420 |
tokio-rs/tokio:tokio/tests/macros_select.rs:12 | }
#[tokio::test]
async fn never_branch_no_warnings() {
let t = tokio::select! {
_ = async_never() => 0,
one_async_ready = one() => one_async_ready,
};
assert_eq!(t, 1);
}
async fn one() -> usize {
1
}
async fn require_mutable(_: &mut i32) {}
async fn async_noop() {}
async fn async_ne... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | e09b90ea32385337170ce17eb55ab372f9388af5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e09b90ea32385337170ce17eb55ab372f9388af5/tokio/tests/macros_select.rs | 441 | 481 |
tokio-rs/tokio:tokio/tests/macros_select.rs:12 | }
#[tokio::test]
async fn never_branch_no_warnings() {
let t = tokio::select! {
_ = async_never() => 0,
one_async_ready = one() => one_async_ready,
};
assert_eq!(t, 1);
}
async fn one() -> usize {
1
}
async fn require_mutable(_: &mut i32) {}
async fn async_noop() {}
async fn async_ne... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 027351dd3a6da88d1b2ed9c687b96fa4ca8a7a6d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/027351dd3a6da88d1b2ed9c687b96fa4ca8a7a6d/tokio/tests/macros_select.rs | 441 | 464 |
tokio-rs/tokio:tokio/tests/macros_select.rs:11 | 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 | 9264b837d897dcdf974703a6739132b995e669bc | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9264b837d897dcdf974703a6739132b995e669bc/tokio/tests/macros_select.rs | 401 | 448 |
tokio-rs/tokio:tokio/tests/macros_select.rs:1 | use tokio::sync::{mpsc, oneshot};
use tokio::task;
use tokio_test::{assert_ok, assert_pending, assert_ready};
use futures::future::poll_fn;
use std::task::Poll::Ready;
#[tokio::test]
async fn sync_one_lit_expr_comma() {
let foo = tokio::select! {
foo = async { 1 } => foo,
};
assert_eq!(foo, 1);
}... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 8cf98d694663e8397bfc337e7a4676567287bfae | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8cf98d694663e8397bfc337e7a4676567287bfae/tokio/tests/macros_select.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/macros_select.rs:2 | };
assert_eq!(foo, 1);
}
#[tokio::test]
async fn sync_one_await() {
let foo = tokio::select! {
foo = one() => foo,
};
assert_eq!(foo, 1);
}
#[tokio::test]
async fn sync_one_ident() {
let one = one();
let foo = tokio::select! {
foo = one => foo,
};
assert_eq!(foo, 1)... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 8cf98d694663e8397bfc337e7a4676567287bfae | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8cf98d694663e8397bfc337e7a4676567287bfae/tokio/tests/macros_select.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/macros_select.rs:3 | };
assert_eq!(1, cnt.get());
assert!(res == 1 || res == 2);
}
#[tokio::test]
async fn drop_in_fut() {
let s = "hello".to_string();
let res = tokio::select! {
foo = async {
let v = one().await;
drop(s);
v
} => foo
};
assert_eq!(res, 1);
}
#... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 8cf98d694663e8397bfc337e7a4676567287bfae | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8cf98d694663e8397bfc337e7a4676567287bfae/tokio/tests/macros_select.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/macros_select.rs:4 | let (tx1, mut rx1) = mpsc::unbounded_channel::<i32>();
let (tx2, mut rx2) = mpsc::unbounded_channel::<i32>();
tokio::spawn(async move {
assert_ok!(tx2.send(1));
task::yield_now().await;
assert_ok!(tx1.send(2));
task::yield_now().await;
assert_ok!(tx2.send(3));
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 8cf98d694663e8397bfc337e7a4676567287bfae | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8cf98d694663e8397bfc337e7a4676567287bfae/tokio/tests/macros_select.rs | 121 | 180 |
tokio-rs/tokio:tokio/tests/macros_select.rs:5 | let (tx2, mut rx2) = oneshot::channel::<i32>();
tx1.send(1).unwrap();
tx2.send(2).unwrap();
let ran;
tokio::select! {
res = &mut rx1 => {
assert_eq!(1, assert_ok!(res));
assert_eq!(2, assert_ok!(rx2.await));
ran = true;
},
res = &mut rx2 => ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 8cf98d694663e8397bfc337e7a4676567287bfae | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8cf98d694663e8397bfc337e7a4676567287bfae/tokio/tests/macros_select.rs | 161 | 220 |
tokio-rs/tokio:tokio/tests/macros_select.rs:6 | let fut = async {
let ready = future::ready(0i32);
tokio::select! {
_ = ready => {},
}
};
assert!(mem::size_of_val(&fut) <= 32);
let fut = async {
let ready1 = future::ready(0i32);
let ready2 = future::ready(0i32);
tokio::select! {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 8cf98d694663e8397bfc337e7a4676567287bfae | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8cf98d694663e8397bfc337e7a4676567287bfae/tokio/tests/macros_select.rs | 201 | 260 |
tokio-rs/tokio:tokio/tests/macros_select.rs:7 | let mut value = 234;
tokio::select! {
_ = require_mutable(&mut value) => { },
_ = async_noop() => {
value += 5;
},
}
assert!(value >= 234);
}
#[tokio::test]
async fn mutable_borrowing_future_with_same_borrow_in_block_and_else() {
let mut value = 234;
tokio::se... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 8cf98d694663e8397bfc337e7a4676567287bfae | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8cf98d694663e8397bfc337e7a4676567287bfae/tokio/tests/macros_select.rs | 241 | 300 |
tokio-rs/tokio:tokio/tests/macros_select.rs:8 | 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 = assert_ready!(f.poll());
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 8cf98d694663e8397bfc337e7a4676567287bfae | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8cf98d694663e8397bfc337e7a4676567287bfae/tokio/tests/macros_select.rs | 281 | 340 |
tokio-rs/tokio:tokio/tests/macros_select.rs:9 | #[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::select... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 8cf98d694663e8397bfc337e7a4676567287bfae | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8cf98d694663e8397bfc337e7a4676567287bfae/tokio/tests/macros_select.rs | 321 | 380 |
tokio-rs/tokio:tokio/tests/macros_select.rs:10 | let mut delay = time::delay_for(Duration::from_millis(50));
tokio::select! {
_ = &mut delay, if !delay.is_elapsed() => {
}
_ = async { 1 } => {
}
}
}
#[tokio::test]
async fn many_branches() {
let num = tokio::select! {
x = async { 1 } => x,
x = async { 1 } =... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 8cf98d694663e8397bfc337e7a4676567287bfae | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8cf98d694663e8397bfc337e7a4676567287bfae/tokio/tests/macros_select.rs | 361 | 420 |
tokio-rs/tokio:tokio/tests/macros_select.rs:11 | 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 | 8cf98d694663e8397bfc337e7a4676567287bfae | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8cf98d694663e8397bfc337e7a4676567287bfae/tokio/tests/macros_select.rs | 401 | 447 |
tokio-rs/tokio:tokio/tests/macros_test.rs:1 | #![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi doesn't support threading
use tokio::test;
#[test]
async fn test_macro_can_be_used_via_use() {
tokio::spawn(async {}).await.unwrap();
}
#[tokio::test]
async fn test_macro_is_resilient_to_shadowing() {
tokio::spawn(async {}).await.unwrap();
}
//... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_test.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/macros_test.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/macros_test.rs:2 | // https://github.com/tokio-rs/tokio/issues/4175
#[tokio::main]
pub async fn issue_4175_main_1() -> ! {
panic!();
}
#[tokio::main]
pub async fn issue_4175_main_2() -> std::io::Result<()> {
panic!();
}
#[allow(unreachable_code)]
#[tokio::test]
pub async fn issue_4175_test() -> std::io::Result<()> {
return Ok... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_test.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/macros_test.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/macros_test.rs:3 | // https://github.com/tokio-rs/tokio/issues/5243
pub mod issue_5243 {
macro_rules! mac {
(async fn $name:ident() $b:block) => {
#[::tokio::test]
async fn $name() {
$b
}
};
}
mac!(
async fn foo() {}
);
}
#[tokio::test(name = "a ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_test.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/macros_test.rs | 81 | 124 |
tokio-rs/tokio:tokio/tests/macros_test.rs:2 | // https://github.com/tokio-rs/tokio/issues/4175
#[tokio::main]
pub async fn issue_4175_main_1() -> ! {
panic!();
}
#[tokio::main]
pub async fn issue_4175_main_2() -> std::io::Result<()> {
panic!();
}
#[allow(unreachable_code)]
#[tokio::test]
pub async fn issue_4175_test() -> std::io::Result<()> {
return Ok... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_test.rs | MIT | 7f09959b0a13cbea2b0e5c20ec1b7ac3f208dbad | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7f09959b0a13cbea2b0e5c20ec1b7ac3f208dbad/tokio/tests/macros_test.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/macros_test.rs:3 | // https://github.com/tokio-rs/tokio/issues/5243
pub mod issue_5243 {
macro_rules! mac {
(async fn $name:ident() $b:block) => {
#[::tokio::test]
async fn $name() {
$b
}
};
}
mac!(
async fn foo() {}
);
}
#[cfg(tokio_unstable)]
p... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_test.rs | MIT | 7f09959b0a13cbea2b0e5c20ec1b7ac3f208dbad | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7f09959b0a13cbea2b0e5c20ec1b7ac3f208dbad/tokio/tests/macros_test.rs | 81 | 117 |
tokio-rs/tokio:tokio/tests/macros_test.rs:1 | #![allow(unknown_lints, unexpected_cfgs)]
#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi doesn't support threading
use tokio::test;
#[test]
async fn test_macro_can_be_used_via_use() {
tokio::spawn(async {}).await.unwrap();
}
#[tokio::test]
async fn test_macro_is_resilient_to_shadowing() {
to... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_test.rs | MIT | 833ee027d0ec44d88765157ec98b6809f0070169 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/833ee027d0ec44d88765157ec98b6809f0070169/tokio/tests/macros_test.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/macros_test.rs:2 | }
// https://github.com/tokio-rs/tokio/issues/4175
#[tokio::main]
pub async fn issue_4175_main_1() -> ! {
panic!();
}
#[tokio::main]
pub async fn issue_4175_main_2() -> std::io::Result<()> {
panic!();
}
#[allow(unreachable_code)]
#[tokio::test]
pub async fn issue_4175_test() -> std::io::Result<()> {
return... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_test.rs | MIT | 833ee027d0ec44d88765157ec98b6809f0070169 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/833ee027d0ec44d88765157ec98b6809f0070169/tokio/tests/macros_test.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/macros_test.rs:2 | // https://github.com/tokio-rs/tokio/issues/4175
#[tokio::main]
pub async fn issue_4175_main_1() -> ! {
panic!();
}
#[tokio::main]
pub async fn issue_4175_main_2() -> std::io::Result<()> {
panic!();
}
#[allow(unreachable_code)]
#[tokio::test]
pub async fn issue_4175_test() -> std::io::Result<()> {
return Ok... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_test.rs | MIT | b6d0c9091d4f3c6a90ad8764d3c65f8480a48676 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b6d0c9091d4f3c6a90ad8764d3c65f8480a48676/tokio/tests/macros_test.rs | 41 | 94 |
tokio-rs/tokio:tokio/tests/macros_test.rs:3 | // https://github.com/tokio-rs/tokio/issues/5243
pub mod issue_5243 {
macro_rules! mac {
(async fn $name:ident() $b:block) => {
#[::tokio::test]
async fn $name() {
$b
}
};
}
mac!(
async fn foo() {}
);
} | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_test.rs | MIT | b6d0c9091d4f3c6a90ad8764d3c65f8480a48676 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b6d0c9091d4f3c6a90ad8764d3c65f8480a48676/tokio/tests/macros_test.rs | 81 | 94 |
tokio-rs/tokio:tokio/tests/macros_test.rs:1 | #![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi doesn't support threading
use tokio::test;
#[test]
async fn test_macro_can_be_used_via_use() {
tokio::spawn(async {}).await.unwrap();
}
#[tokio::test]
async fn test_macro_is_resilient_to_shadowing() {
tokio::spawn(async {}).await.unwrap();
}
//... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_test.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/macros_test.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/macros_test.rs:2 | #[tokio::main]
pub async fn issue_4175_main_2() -> std::io::Result<()> {
panic!();
}
#[allow(unreachable_code)]
#[tokio::test]
pub async fn issue_4175_test() -> std::io::Result<()> {
return Ok(());
panic!();
}
// https://github.com/tokio-rs/tokio/issues/4175
#[allow(clippy::let_unit_value)]
pub mod clippy_... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_test.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/macros_test.rs | 41 | 88 |
tokio-rs/tokio:tokio/tests/macros_test.rs:1 | #![cfg(all(feature = "full", not(tokio_wasi)))] // Wasi doesn't support threading
use tokio::test;
#[test]
async fn test_macro_can_be_used_via_use() {
tokio::spawn(async {}).await.unwrap();
}
#[tokio::test]
async fn test_macro_is_resilient_to_shadowing() {
tokio::spawn(async {}).await.unwrap();
}
// https:/... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_test.rs | MIT | 5d25ec46d5fffaf52dbe3c87df0a35a61041a974 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/5d25ec46d5fffaf52dbe3c87df0a35a61041a974/tokio/tests/macros_test.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/macros_test.rs:2 | #[tokio::main]
pub async fn issue_4175_main_2() -> std::io::Result<()> {
panic!();
}
#[allow(unreachable_code)]
#[tokio::test]
pub async fn issue_4175_test() -> std::io::Result<()> {
return Ok(());
panic!();
}
// https://github.com/tokio-rs/tokio/issues/4175
#[allow(clippy::let_unit_value)]
pub mod clippy_... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_test.rs | MIT | fc9518b62714daac9a38b46c698b94ac5d5b1ca2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fc9518b62714daac9a38b46c698b94ac5d5b1ca2/tokio/tests/macros_test.rs | 41 | 73 |
tokio-rs/tokio:tokio/tests/macros_test.rs:1 | #![cfg(all(feature = "full", not(tokio_wasi)))] // Wasi doesn't support threading
use tokio::test;
#[test]
async fn test_macro_can_be_used_via_use() {
tokio::spawn(async {}).await.unwrap();
}
#[tokio::test]
async fn test_macro_is_resilient_to_shadowing() {
tokio::spawn(async {}).await.unwrap();
}
// https:/... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_test.rs | MIT | b2ada60e701d5c9e6644cf8fc42a100774f8e23f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/tests/macros_test.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/macros_test.rs:2 | #[tokio::main]
pub async fn issue_4175_main_2() -> std::io::Result<()> {
panic!();
}
#[allow(unreachable_code)]
#[tokio::test]
pub async fn issue_4175_test() -> std::io::Result<()> {
return Ok(());
panic!();
}
// https://github.com/tokio-rs/tokio/issues/4175
pub mod clippy_semicolon_if_nothing_returned {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_test.rs | MIT | b2ada60e701d5c9e6644cf8fc42a100774f8e23f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/tests/macros_test.rs | 41 | 72 |
tokio-rs/tokio:tokio/tests/macros_test.rs:1 | #![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi doesn't support threading
use tokio::test;
#[test]
async fn test_macro_can_be_used_via_use() {
tokio::spawn(async {}).await.unwrap();
}
#[tokio::test]
async fn test_macro_is_resilient_to_shadowing() {
tokio::spawn(async {}).await.unwrap();
}
//... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_test.rs | MIT | 6d3f92dddc510e9276191cfab1b0432ce8248589 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6d3f92dddc510e9276191cfab1b0432ce8248589/tokio/tests/macros_test.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/macros_test.rs:1 | #![cfg(feature = "full")]
use tokio::test;
#[test]
async fn test_macro_can_be_used_via_use() {
tokio::spawn(async {}).await.unwrap();
}
#[tokio::test]
async fn test_macro_is_resilient_to_shadowing() {
tokio::spawn(async {}).await.unwrap();
}
// https://github.com/tokio-rs/tokio/issues/3403
#[rustfmt::skip] ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_test.rs | MIT | 2747043f6f7e0870cc5aa72c146dfae9543c5ba8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2747043f6f7e0870cc5aa72c146dfae9543c5ba8/tokio/tests/macros_test.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/macros_test.rs:1 | use tokio::test;
#[test]
async fn test_macro_can_be_used_via_use() {
tokio::spawn(async {}).await.unwrap();
}
#[tokio::test]
async fn test_macro_is_resilient_to_shadowing() {
tokio::spawn(async {}).await.unwrap();
}
// https://github.com/tokio-rs/tokio/issues/3403
#[rustfmt::skip] // this `rustfmt::skip` is ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_test.rs | MIT | 8943e8aeef0b33f371d6dc69f62b38da390b5d5f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8943e8aeef0b33f371d6dc69f62b38da390b5d5f/tokio/tests/macros_test.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/macros_test.rs:2 | panic!();
}
#[allow(unreachable_code)]
#[tokio::test]
pub async fn issue_4175_test() -> std::io::Result<()> {
return Ok(());
panic!();
}
// https://github.com/tokio-rs/tokio/issues/4175
pub mod clippy_semicolon_if_nothing_returned {
#![deny(clippy::semicolon_if_nothing_returned)]
#[tokio::main]
pu... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_test.rs | MIT | 8943e8aeef0b33f371d6dc69f62b38da390b5d5f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8943e8aeef0b33f371d6dc69f62b38da390b5d5f/tokio/tests/macros_test.rs | 41 | 70 |
tokio-rs/tokio:tokio/tests/macros_test.rs:1 | use tokio::test;
#[test]
async fn test_macro_can_be_used_via_use() {
tokio::spawn(async {}).await.unwrap();
}
#[tokio::test]
async fn test_macro_is_resilient_to_shadowing() {
tokio::spawn(async {}).await.unwrap();
}
// https://github.com/tokio-rs/tokio/issues/3403
#[rustfmt::skip] // this `rustfmt::skip` is ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_test.rs | MIT | 095012b03be44b6f023553292e05fe7d5cf35a98 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/095012b03be44b6f023553292e05fe7d5cf35a98/tokio/tests/macros_test.rs | 1 | 48 |
tokio-rs/tokio:tokio/tests/macros_test.rs:1 | use tokio::test;
#[test]
async fn test_macro_can_be_used_via_use() {
tokio::spawn(async {}).await.unwrap();
}
#[tokio::test]
async fn test_macro_is_resilient_to_shadowing() {
tokio::spawn(async {}).await.unwrap();
}
// https://github.com/tokio-rs/tokio/issues/3403
#[rustfmt::skip] // this `rustfmt::skip` is ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_test.rs | MIT | 9d8b37d51a7d0cdf5a0fbf754240c929fb69e9f2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9d8b37d51a7d0cdf5a0fbf754240c929fb69e9f2/tokio/tests/macros_test.rs | 1 | 32 |
tokio-rs/tokio:tokio/tests/macros_test.rs:1 | use tokio::test;
#[test]
async fn test_macro_can_be_used_via_use() {
tokio::spawn(async {
assert_eq!(1 + 1, 2);
})
.await
.unwrap();
}
#[tokio::test]
async fn test_macro_is_resilient_to_shadowing() {
tokio::spawn(async {
assert_eq!(1 + 1, 2);
})
.await
.unwrap();
}
// ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_test.rs | MIT | f9ce18a52451fdc55c247f0901cebc3f9171e75a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f9ce18a52451fdc55c247f0901cebc3f9171e75a/tokio/tests/macros_test.rs | 1 | 40 |
tokio-rs/tokio:tokio/tests/macros_test.rs:1 | use tokio::test;
#[test]
async fn test_macro_can_be_used_via_use() {
tokio::spawn(async {
assert_eq!(1 + 1, 2);
})
.await
.unwrap();
}
#[tokio::test]
async fn test_macro_is_resilient_to_shadowing() {
tokio::spawn(async {
assert_eq!(1 + 1, 2);
})
.await
.unwrap();
}
// ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_test.rs | MIT | 40d959263bc16771882b2d1c9356f1ec02957c3d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/40d959263bc16771882b2d1c9356f1ec02957c3d/tokio/tests/macros_test.rs | 1 | 27 |
tokio-rs/tokio:tokio/tests/macros_test.rs:1 | use tokio::test;
#[test]
async fn test_macro_can_be_used_via_use() {
tokio::spawn(async {
assert_eq!(1 + 1, 2);
})
.await
.unwrap();
}
#[tokio::test]
async fn test_macro_is_resilient_to_shadowing() {
tokio::spawn(async {
assert_eq!(1 + 1, 2);
})
.await
.unwrap();
} | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_test.rs | MIT | 1cc016833569e2dbae3b0431b7c87d5e75ef5de6 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1cc016833569e2dbae3b0431b7c87d5e75ef5de6/tokio/tests/macros_test.rs | 1 | 19 |
tokio-rs/tokio:tokio/tests/macros_try_join.rs:1 | #![cfg(feature = "macros")]
#![allow(clippy::disallowed_names)]
use std::{convert::Infallible, sync::Arc};
use tokio::sync::{oneshot, Semaphore};
use tokio_test::{assert_pending, assert_ready, task};
#[cfg(all(target_family = "wasm", not(target_os = "wasi")))]
use wasm_bindgen_test::wasm_bindgen_test as maybe_tokio_... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_try_join.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/macros_try_join.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/macros_try_join.rs:2 | #[maybe_tokio_test]
async fn sync_two_lit_expr_no_comma() {
let foo = tokio::try_join!(async { ok(1) }, async { ok(2) });
assert_eq!(foo, Ok((1, 2)));
let foo = tokio::try_join!(biased; async { ok(1) }, async { ok(2) });
assert_eq!(foo, Ok((1, 2)));
}
#[maybe_tokio_test]
async fn two_await() {
let... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_try_join.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/macros_try_join.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/macros_try_join.rs:3 | tx2.send(123).unwrap();
assert!(join.is_woken());
assert_pending!(join.poll());
drop(tx1);
assert!(join.is_woken());
let res = assert_ready!(join.poll());
assert!(res.is_err());
}
#[test]
#[cfg(target_pointer_width = "64")]
fn try_join_size() {
use futures::future;
use std::mem;
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_try_join.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/macros_try_join.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/macros_try_join.rs:4 | // Another task should run after this task uses its whole budget
for _ in 0..128 {
let _permit = permits.clone().acquire_owned().await.unwrap();
}
exceeded_budget += 1;
}
Ok(exceeded_budget)
}
async fn poor_little_task(permits: Arc<Semaphore>) -> Result<usize, String> {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_try_join.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/macros_try_join.rs | 121 | 180 |
tokio-rs/tokio:tokio/tests/macros_try_join.rs:5 | 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 {
for _ in 0..4 {
{
let mut guard = poll_order.lock().unwrap();
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_try_join.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/macros_try_join.rs | 161 | 220 |
tokio-rs/tokio:tokio/tests/macros_try_join.rs:6 | guard.push(x);
}
tokio::task::yield_now().await;
}
Ok::<(), Infallible>(())
};
tokio::try_join!(
biased;
fut(1, Arc::clone(&poll_order)),
fut(2, Arc::clone(&poll_order)),
fut(3, Arc::clone(&poll_order)),
)
.unwrap();
// Each ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_try_join.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/macros_try_join.rs | 201 | 260 |
tokio-rs/tokio:tokio/tests/macros_try_join.rs:7 | };
assert_eq!(mem::size_of_val(&fut), 40);
}
#[tokio::test]
async fn empty_try_join() {
assert_eq!(tokio::try_join!() as Result<_, ()>, Ok(()));
assert_eq!(tokio::try_join!(biased;) as Result<_, ()>, Ok(()));
}
// Regression test for: https://github.com/tokio-rs/tokio/issues/7637
// We want to make sure t... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_try_join.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/macros_try_join.rs | 241 | 269 |
tokio-rs/tokio:tokio/tests/macros_try_join.rs:6 | guard.push(x);
}
tokio::task::yield_now().await;
}
Ok::<(), Infallible>(())
};
tokio::try_join!(
biased;
fut(1, Arc::clone(&poll_order)),
fut(2, Arc::clone(&poll_order)),
fut(3, Arc::clone(&poll_order)),
)
.unwrap();
// Each ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_try_join.rs | MIT | 8e999e380643160f0e944fd5708de2bd3d1b0d51 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8e999e380643160f0e944fd5708de2bd3d1b0d51/tokio/tests/macros_try_join.rs | 201 | 249 |
tokio-rs/tokio:tokio/tests/macros_try_join.rs:1 | #![cfg(feature = "macros")]
#![allow(clippy::disallowed_names)]
use std::sync::Arc;
use tokio::sync::{oneshot, Semaphore};
use tokio_test::{assert_pending, assert_ready, task};
#[cfg(all(target_family = "wasm", not(target_os = "wasi")))]
use wasm_bindgen_test::wasm_bindgen_test as maybe_tokio_test;
#[cfg(not(all(ta... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_try_join.rs | MIT | 84c5674c601dfc36ab417ff0ec01763c2dd30a5c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/84c5674c601dfc36ab417ff0ec01763c2dd30a5c/tokio/tests/macros_try_join.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/macros_try_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::try_join!(rx1, rx2) });
assert_pending!(join.poll());
tx2.send(123).unwrap();
assert!(join.is_woken());
assert_p... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_try_join.rs | MIT | 84c5674c601dfc36ab417ff0ec01763c2dd30a5c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/84c5674c601dfc36ab417ff0ec01763c2dd30a5c/tokio/tests/macros_try_join.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/macros_try_join.rs:3 | assert!(res.is_err());
}
#[test]
#[cfg(target_pointer_width = "64")]
fn join_size() {
use futures::future;
use std::mem;
let fut = async {
let ready = future::ready(ok(0i32));
tokio::try_join!(ready)
};
assert_eq!(mem::size_of_val(&fut), 32);
let fut = async {
let read... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_try_join.rs | MIT | 84c5674c601dfc36ab417ff0ec01763c2dd30a5c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/84c5674c601dfc36ab417ff0ec01763c2dd30a5c/tokio/tests/macros_try_join.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/macros_try_join.rs:4 | Ok(exceeded_budget)
}
async fn poor_little_task(permits: Arc<Semaphore>) -> Result<usize, String> {
let mut how_many_times_i_got_to_run = 0;
for _ in 0..5 {
let _permit = permits.clone().acquire_owned().await.unwrap();
how_many_times_i_got_to_run += 1;
}
Ok(how_many_times_i_got_to_ru... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_try_join.rs | MIT | 84c5674c601dfc36ab417ff0ec01763c2dd30a5c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/84c5674c601dfc36ab417ff0ec01763c2dd30a5c/tokio/tests/macros_try_join.rs | 121 | 180 |
tokio-rs/tokio:tokio/tests/macros_try_join.rs:5 | guard.push(x);
}
tokio::task::yield_now().await;
}
};
tokio::join!(
fut(1, Arc::clone(&poll_order)),
fut(2, Arc::clone(&poll_order)),
fut(3, Arc::clone(&poll_order)),
);
// Each time the future created by join! is polled, it should start
// ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_try_join.rs | MIT | 84c5674c601dfc36ab417ff0ec01763c2dd30a5c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/84c5674c601dfc36ab417ff0ec01763c2dd30a5c/tokio/tests/macros_try_join.rs | 161 | 185 |
tokio-rs/tokio:tokio/tests/macros_try_join.rs:1 | #![cfg(feature = "macros")]
#![allow(clippy::disallowed_names)]
use std::sync::Arc;
use tokio::sync::{oneshot, Semaphore};
use tokio_test::{assert_pending, assert_ready, task};
#[cfg(all(target_family = "wasm", not(target_os = "wasi")))]
use wasm_bindgen_test::wasm_bindgen_test as maybe_tokio_test;
#[cfg(not(all(ta... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_try_join.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/macros_try_join.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/macros_try_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::try_join!(async { rx1.await }, async { rx2.await }) });
assert_pending!(join.poll());
tx2.send(123).unwrap();
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_try_join.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/macros_try_join.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/macros_try_join.rs:3 | drop(tx1);
assert!(join.is_woken());
let res = assert_ready!(join.poll());
assert!(res.is_err());
}
#[test]
#[cfg(target_pointer_width = "64")]
fn join_size() {
use futures::future;
use std::mem;
let fut = async {
let ready = future::ready(ok(0i32));
tokio::try_join!(ready)
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_try_join.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/macros_try_join.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/macros_try_join.rs:4 | }
exceeded_budget += 1;
}
Ok(exceeded_budget)
}
async fn poor_little_task(permits: Arc<Semaphore>) -> Result<usize, String> {
let mut how_many_times_i_got_to_run = 0;
for _ in 0..5 {
let _permit = permits.clone().acquire_owned().await.unwrap();
how_many_times_i_got_to_run +=... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_try_join.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/macros_try_join.rs | 121 | 180 |
tokio-rs/tokio:tokio/tests/macros_try_join.rs:5 | let fut = |x, poll_order: Arc<std::sync::Mutex<Vec<i32>>>| async move {
for _ in 0..4 {
{
let mut guard = poll_order.lock().unwrap();
guard.push(x);
}
tokio::task::yield_now().await;
}
};
tokio::join!(
fut(1, Arc::clo... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_try_join.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/macros_try_join.rs | 161 | 190 |
tokio-rs/tokio:tokio/tests/macros_try_join.rs:1 | #![cfg(feature = "macros")]
#![allow(clippy::disallowed_names)]
use std::sync::Arc;
use tokio::sync::{oneshot, Semaphore};
use tokio_test::{assert_pending, assert_ready, task};
#[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 ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_try_join.rs | MIT | ca9f7ee9f4750d6bb8a073ab4df1b7e4555857ad | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ca9f7ee9f4750d6bb8a073ab4df1b7e4555857ad/tokio/tests/macros_try_join.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/macros_try_join.rs:5 | let fut = |x, poll_order: Arc<std::sync::Mutex<Vec<i32>>>| async move {
for _ in 0..4 {
{
let mut guard = poll_order.lock().unwrap();
guard.push(x);
}
tokio::task::yield_now().await;
}
};
tokio::join!(
fut(1, Arc::clo... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_try_join.rs | MIT | 22cff80048c62ed0fa20065888667d00d5aedd14 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/22cff80048c62ed0fa20065888667d00d5aedd14/tokio/tests/macros_try_join.rs | 161 | 185 |
tokio-rs/tokio:tokio/tests/macros_try_join.rs:1 | #![cfg(feature = "macros")]
#![allow(clippy::blacklisted_name)]
use std::sync::Arc;
use tokio::sync::{oneshot, Semaphore};
use tokio_test::{assert_pending, assert_ready, task};
#[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 ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_try_join.rs | MIT | 6929decf2cdb391e26f0e5c8d742f7aef51743b9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6929decf2cdb391e26f0e5c8d742f7aef51743b9/tokio/tests/macros_try_join.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/macros_try_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::try_join!(async { rx1.await }, async { rx2.await }) });
assert_pending!(join.poll());
tx2.send(123).unwrap();
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_try_join.rs | MIT | b2ada60e701d5c9e6644cf8fc42a100774f8e23f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/tests/macros_try_join.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/macros_try_join.rs:3 | drop(tx1);
assert!(join.is_woken());
let res = assert_ready!(join.poll());
assert!(res.is_err());
}
#[test]
fn join_size() {
use futures::future;
use std::mem;
let fut = async {
let ready = future::ready(ok(0i32));
tokio::try_join!(ready)
};
assert_eq!(mem::size_of_va... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_try_join.rs | MIT | b2ada60e701d5c9e6644cf8fc42a100774f8e23f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/tests/macros_try_join.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/macros_try_join.rs:4 | exceeded_budget += 1;
}
Ok(exceeded_budget)
}
async fn poor_little_task(permits: Arc<Semaphore>) -> Result<usize, String> {
let mut how_many_times_i_got_to_run = 0;
for _ in 0..5 {
let _permit = permits.clone().acquire_owned().await.unwrap();
how_many_times_i_got_to_run += 1;
}
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_try_join.rs | MIT | b2ada60e701d5c9e6644cf8fc42a100774f8e23f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/tests/macros_try_join.rs | 121 | 180 |
tokio-rs/tokio:tokio/tests/macros_try_join.rs:5 | for _ in 0..4 {
{
let mut guard = poll_order.lock().unwrap();
guard.push(x);
}
tokio::task::yield_now().await;
}
};
tokio::join!(
fut(1, Arc::clone(&poll_order)),
fut(2, Arc::clone(&poll_order)),
fut(3, Arc::c... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_try_join.rs | MIT | b2ada60e701d5c9e6644cf8fc42a100774f8e23f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/tests/macros_try_join.rs | 161 | 184 |
tokio-rs/tokio:tokio/tests/macros_try_join.rs:1 | #![cfg(feature = "macros")]
#![allow(clippy::blacklisted_name)]
use std::sync::Arc;
use tokio::sync::{oneshot, Semaphore};
use tokio_test::{assert_pending, assert_ready, task};
#[cfg(all(target_family = "wasm", not(target_os = "wasi")))]
use wasm_bindgen_test::wasm_bindgen_test as maybe_tokio_test;
#[cfg(not(all(ta... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_try_join.rs | MIT | 0dc62da21b0bffe113e2efa23f6da6ef4e36bf4f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0dc62da21b0bffe113e2efa23f6da6ef4e36bf4f/tokio/tests/macros_try_join.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/macros_try_join.rs:1 | #![cfg(feature = "macros")]
#![allow(clippy::blacklisted_name)]
use std::sync::Arc;
use tokio::sync::{oneshot, Semaphore};
use tokio_test::{assert_pending, assert_ready, task};
#[cfg(all(target_arch = "wasm32", not(target_os = "wasi")))]
use wasm_bindgen_test::wasm_bindgen_test as maybe_tokio_test;
#[cfg(not(all(ta... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_try_join.rs | MIT | f3e340a35b306e926e78537a0dd65b2e9b9cdc89 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f3e340a35b306e926e78537a0dd65b2e9b9cdc89/tokio/tests/macros_try_join.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/macros_try_join.rs:3 | drop(tx1);
assert!(join.is_woken());
let res = assert_ready!(join.poll());
assert!(res.is_err());
}
#[test]
fn join_size() {
use futures::future;
use std::mem;
let fut = async {
let ready = future::ready(ok(0i32));
tokio::try_join!(ready)
};
assert_eq!(mem::size_of_va... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_try_join.rs | MIT | 6d3f92dddc510e9276191cfab1b0432ce8248589 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6d3f92dddc510e9276191cfab1b0432ce8248589/tokio/tests/macros_try_join.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/macros_try_join.rs:1 | #![cfg(feature = "macros")]
#![allow(clippy::blacklisted_name)]
use std::sync::Arc;
use tokio::sync::{oneshot, Semaphore};
use tokio_test::{assert_pending, assert_ready, task};
#[cfg(target_arch = "wasm32")]
use wasm_bindgen_test::wasm_bindgen_test as maybe_tokio_test;
#[cfg(not(target_arch = "wasm32"))]
use tokio:... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_try_join.rs | MIT | 1872a425e2b56530b46d44baf7bb45c1ee503807 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1872a425e2b56530b46d44baf7bb45c1ee503807/tokio/tests/macros_try_join.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/macros_try_join.rs:1 | #![cfg(feature = "macros")]
#![allow(clippy::blacklisted_name)]
use tokio::sync::oneshot;
use tokio_test::{assert_pending, assert_ready, task};
#[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;
#[mayb... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_try_join.rs | MIT | 2747043f6f7e0870cc5aa72c146dfae9543c5ba8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2747043f6f7e0870cc5aa72c146dfae9543c5ba8/tokio/tests/macros_try_join.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/macros_try_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::try_join!(async { rx1.await }, async { rx2.await }) });
assert_pending!(join.poll());
tx2.send(123).unwrap();
a... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_try_join.rs | MIT | 2747043f6f7e0870cc5aa72c146dfae9543c5ba8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2747043f6f7e0870cc5aa72c146dfae9543c5ba8/tokio/tests/macros_try_join.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/macros_try_join.rs:3 | assert!(join.is_woken());
let res = assert_ready!(join.poll());
assert!(res.is_err());
}
#[test]
fn join_size() {
use futures::future;
use std::mem;
let fut = async {
let ready = future::ready(ok(0i32));
tokio::try_join!(ready)
};
assert_eq!(mem::size_of_val(&fut), 16);
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_try_join.rs | MIT | 2747043f6f7e0870cc5aa72c146dfae9543c5ba8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2747043f6f7e0870cc5aa72c146dfae9543c5ba8/tokio/tests/macros_try_join.rs | 81 | 109 |
tokio-rs/tokio:tokio/tests/macros_try_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::try_join!(async { ok(1) },);
assert_eq!(foo, Ok((1,)));
}
#[tokio::test]
async fn sync_one_lit_expr_no_comma() {
let foo... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_try_join.rs | MIT | 9264b837d897dcdf974703a6739132b995e669bc | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9264b837d897dcdf974703a6739132b995e669bc/tokio/tests/macros_try_join.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/macros_try_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: Result<(&str, u32), _> = assert_ready!(join.poll());
assert_eq!(Ok(("hello", 123)), res);
}
#[tokio::test]
async fn... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_try_join.rs | MIT | 9264b837d897dcdf974703a6739132b995e669bc | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9264b837d897dcdf974703a6739132b995e669bc/tokio/tests/macros_try_join.rs | 41 | 100 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.