Skip to content

Provide a way to uniquely identify a test?  #2941

Closed
@matklad

Description

@matklad

Currently Cargo + test harness allow to easily identify a test inside the crate by specifying a :: separated path. However this does not uniquely identify a test, because it may live in different crates.

Today, cargo provides --lib, --bin name, --example name etc flags to select a test binary. I think this is a bit suboptimal:

  • there are different flags to do essentially the same
  • this is not machine friendly: we'd needed a bit of boilerplate in IntelliJ Rust to sort the flags out (and the initial version contained a bug, because I didn't noticed that you must not provide a package name with --lib)
  • this is not UI friendly, it's difficult to provide a test name which can be just copy pasted into the shell
  • it is not clear how this should be extended to workspaces, where you'd need to identify a package as well.

So perhaps we need to invent some kind of fully-qualified test name? Something along the lines of ::package_name::target_withing_a_package::harness_specific_name?

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Command-test

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions