Closed
Description
Problem
In a crate with
[lib]
test = false
usually cargo does not build and run the unit tests for the lib crate. However when doing cargo test -- x
, they do get built and run. This seems to be a recent regression.
Steps
cargo new --lib mylib
,cd mylib
- edit
Cargo.toml
to add
[lib]
test = false
- Run
cargo test
. It only runs doctests:
Doc-tests myib
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
- Run
cargo test -- x
. Now it runs the disabled unittests:
Running unittests src/lib.rs (target/debug/deps/myib-81de13cd7bf5f5d9)
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 1 filtered out; finished in 0.00s
It also does not run the doctests.
(This only happens with nightly. With stable, it runs the doctests.)
I would expect it to behave like stable, where it runs the doctests (and passes x
to the test runner as a filter).
Possible Solution(s)
No response
Notes
No response
Version
cargo 1.66.0-nightly (0b84a35c2 2022-10-03)
release: 1.66.0-nightly
commit-hash: 0b84a35c2c7d70df4875a03eb19084b0e7a543ef
commit-date: 2022-10-03
host: x86_64-unknown-linux-gnu
libgit2: 1.5.0 (sys:0.15.0 vendored)
libcurl: 7.83.1-DEV (sys:0.4.55+curl-7.83.1 vendored ssl:OpenSSL/1.1.1q)
os: Debian testing (bookworm) [64-bit]