Skip to main content

Crate test_executors_proc

Crate test_executors_proc 

Source
Expand description

The expansion behind test_executors::async_test.

The crate exists only to hold that one attribute macro; everything public here is re-exported from test_executors, and depending on it directly buys nothing.

The whole reason it is not a one-liner is that a test entry point has two incompatible shapes. On native, #[test] plus a blocking sleep_on is enough. On wasm32 the browser main thread may not block — Atomics.wait traps there — so the future has to be handed to the event loop and the verdict reported once it settles. The macro therefore emits both entry points behind #[cfg] rather than one parameterised one, and resolves the wasm_lite/wasm_lite_std paths through proc_macro_crate so a caller that renames either dependency still compiles.

Attribute Macros§

async_test
A procedural macro that converts an async function into a test function.