You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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
cargo init --lib
src/lib.rs
:cargo test
, this will fail.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 runcheck
on doctests.Version
The text was updated successfully, but these errors were encountered: