Skip to content

cargo test --test does not find any tests #7864

Closed
@mqudsi

Description

@mqudsi

Background: I'm improving fish's dynamic shell completions for cargo to do things like have cargo run --bin <TAB> give you a list of available binaries to choose from for tab completion.

It seems that cargo's dynamic test discovery is broken (or never implemented?).

e.g. while cargo bench --bench returns a list of all benchmarks along with the error message:

$ cargo bench --bench
error: "--bench" takes one argument.
Available benches:
    bench

cargo test --test always returns "no tests available" incorrectly:

$ cargo test --test
error: "--test" takes one argument.
No tests available.

while actually running cargo test shows that cargo has no problem enumerating tests:

mqudsi@ZBOOK /m/c/U/m/g/unquote> cargo test
    Finished test [unoptimized + debuginfo] target(s) in 0.12s
     Running target/debug/deps/unquote-d4809e2bcea39ff6

running 18 tests
... <SNIP>

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Error and warning messages generated by Cargo itself.A-documenting-cargo-itselfArea: Cargo's documentationC-enhancementCategory: enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions