-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test name filtering does not allow disambiguating tests with overlapping names #46408
Comments
Try |
Is that documented anywhere outside of Also, #[test]
fn foo_works() { /* ... */ }
#[test]
fn foo_works_complexly() { /* ... */ }
#[test]
fn bar_works() { /* ... */ } |
You can also |
Both globbing and multiple filters seem like good solutions! |
I might take a stab at implementing this. A couple of questions though:
Probably cc @rust-lang/tools and maybe @sfackler judging from #38181. |
Tests can currently only be filtered by substring or exact match. This makes it difficult to have finer-grained control over which tests to run, such as running only tests with a given suffix in a module, all tests without a given suffix, etc. This PR adds a `--glob` flag to make test name filters use glob patterns instead of string substring matching. This allows commands such as: --glob mymod::*_fast or --glob --skip *_slow The `--glob` flag can normally be omitted, as it is inferred whenever a pattern includes one of the glob special characters (`*`, `?`, or `[`). These characters cannot appear in ordinary test names, so this should not cause unexpected results. If both `--exact` *and* `--glob` are given, `--exact` takes precedence. Fixes rust-lang#46408.
Triage: no changes that I'm aware of. |
Multiple filters already work. You can do For more precise filtering, there's a regex feature request at #53278. |
In that case I suppose this issue can be closed, as the case from the original post can be achieved with
|
Consider the following two tests:
There is currently no way to run only
it_works
, and notit_works_complexly
: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):The text was updated successfully, but these errors were encountered: