rust/tests/coverage/await_ready.rs
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

25 lines
438 B
Rust

#![feature(coverage_attribute)]
#![feature(noop_waker)]
#![coverage(off)]
//@ edition: 2021
//@ aux-build: executor.rs
extern crate executor;
async fn ready() -> u8 {
1
}
#[coverage(on)]
#[rustfmt::skip]
async fn await_ready() -> u8 {
// await should be covered even if the function never yields
ready()
.await
}
fn main() {
let mut future = Box::pin(await_ready());
executor::block_on(future.as_mut());
}