Skip to content

Test name filtering does not allow disambiguating tests with overlapping names #46408

Closed
@jonhoo

Description

@jonhoo

Consider the following two tests:

#[test]
fn it_works() { /* ... */ }
#[test]
fn it_works_complexly() { /* ... */ }

There is currently no way to run only it_works, and not it_works_complexly:

$ cargo t it_works
running 2 tests
test it_works ... ok
test it_works_more ... ok

test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

In Go, the filter is a regular expression, so one can use go test 'it_works$', but this not work in Rust (because the test harness presumably just uses simple substring matching):

$ cargo t 'it_works$'
running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 2 filtered out

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-libtestArea: `#[test]` / the `test` libraryC-enhancementCategory: An issue proposing an enhancement or a PR with one.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions