rust/tests/coverage/async_block.coverage
Zalathar e96b4e479a coverage: Extract executor::block_on from several async coverage tests
By moving `block_on` to an auxiliary crate, we avoid having to keep a separate
copy of it in every async test.

(This also incorporates some small tweaks to the headers in `await_ready.rs`.)
2024-09-10 16:08:36 +10:00

22 lines
664 B
Plaintext

LL| |#![feature(coverage_attribute)]
LL| |#![feature(noop_waker)]
LL| |//@ edition: 2021
LL| |
LL| |//@ aux-build: executor.rs
LL| |extern crate executor;
LL| |
LL| 1|fn main() {
LL| 17| for i in 0..16 {
^16
LL| 16| let future = async {
LL| 16| if i >= 12 {
LL| 4| println!("big");
LL| 12| } else {
LL| 12| println!("small");
LL| 12| }
LL| 16| };
LL| 16| executor::block_on(future);
LL| 16| }
LL| 1|}