Closed as not planned
Description
Problem
While cargo test
runs unit tests AND doctests (no matter if they are marked to run or just to compile), cargo test --all-targets
does not which is counterintuitive. The documentation for --all-targets
reads: "Test all targets".
Steps
- Create a new crate via
cargo init --lib
- Add a failing doctest at the top of
src/lib.rs
://! ``` //! does not compile //! ```
- Run
cargo test
, this will fail. - Run
cargo test --all-targets
, this will pass.
Possible Solution(s)
Also run doctests when --all-targets
is passed.
Notes
This MIGHT be related to #6424, but that issue talks specifically about cargo check
and that is seems to be impossible to run check
on doctests.
Version
cargo 1.63.0 (fd9c4297c 2022-07-01)
release: 1.63.0
commit-hash: fd9c4297ccbee36d39e9a79067edab0b614edb5a
commit-date: 2022-07-01
host: x86_64-unknown-linux-gnu
libgit2: 1.4.2 (sys:0.14.2 vendored)
libcurl: 7.83.1-DEV (sys:0.4.55+curl-7.83.1 vendored ssl:OpenSSL/1.1.1n)
os: Arch Linux [64-bit]