async-attributes icon indicating copy to clipboard operation
async-attributes copied to clipboard

Figure out a way to support checking #[async_attributes::test] in doctests

Open Fishrock123 opened this issue 4 years ago • 0 comments

It would be very valuable for documenting test utils to have cargo check be able to run on #[async_attributes::test] function in doctests.

For example, the obvious errors here would have been caught, as it clearly can't compile: https://github.com/eaze/preroll/blob/c0d15ef0692ef8f933d3501a708f38f0acd69c9a/src/test_utils/mod.rs#L42-L53 (Wrong naming of create_app.)

Unfortunately, `cfg(doctest) seems like it broken and there perhaps is no obvious (or certainly easy) way to fix it, and doesn't seem to be garnering any action: https://github.com/rust-lang/rust/issues/67295

I suggest we find some (even if convoluted) way to run these in doc tests, even if by a manual feature flag.

Fishrock123 avatar Jan 29 '21 21:01 Fishrock123