-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
cargo test tab completion #5759
Comments
#6645 is a proposal. for a solution to this problem |
The other big problem is performance. We have to build and run the binary to discover tests. We could cache them on test runs. |
I opened #12919 in 2023, because both #5759 in 2018 and #6645 in 2019 are inactive but not small.
As small one is subset of the very large one, the small one implement will eventually be part of the very large one implement. So, I think, it deserve a new feat, as first step.
Is it possible to let rustc If not, I think should open a rustc proposal in rfc. |
While small improvements are definitely easier to get done, a CLI option in Cargo once is stabilized hardly get removed. We should take care of avoiding ad-hoc solution for only one command while a general solution might be available. |
To add, this is likely a larger step because of how general it is and how it would interact with the lookup of test names. As a general feature for querying rest names, we'd need higher accuracy than what completions would need. This would mean compiling and running tests on every invocation, rather than caching.
We can't gather than information through a compile step. The information is only available by running the tests themselves. I can't think of a way for an RFC to fix this. |
AFAIK, the only way to add test, is test attr after macro expansion. #[test]
fn it_works() { Is that correct? If so, can let Not same, but there is type CmakeCompileCommands = Array<{
directory: `/${string}`,
command: `/usr/lib/ccache/bin/clang ${string}`,
file: `/${string}.c`,
output: `CMakeFiles/${string}.c.o`
}> Similarly, can adopt this convention to rust like below, or just partially type RustFunctionName = string
type RustCompileCommands = Array<{
directory: `/${string}`,
command: `/path/to/sccache /path/to/rustc ${string}`,
file: `/${string}.rs`,
output: string,
test: RustFunctionName[]
}> |
There are custom test harnesses, like criterion and libtest-mimic. Even then, you are expanding the scope even further for a one-off, short-term feature. |
This remind me of something. When I dive into how |
It would be nice if
cargo test <TAB>
helped me write out the test I'm looking for.For example, in the context of using cargo in the cargo project, if I type
cargo test ove<TAB>
it would be nice if cargo helped me discover the names of the tests intests/testsuite/overrides.rs
that I'm looking for.The text was updated successfully, but these errors were encountered: