1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-07-02 01:55:22 +02:00
tldr/pages/common/cargo-test.md

29 lines
710 B
Markdown
Raw Normal View History

2020-09-08 13:19:03 -03:00
# cargo test
2020-08-30 01:00:03 -03:00
> Execute the unit and integration tests of a Rust package.
> More information: <https://doc.rust-lang.org/cargo/commands/cargo-test.html>.
- Only run tests containing a specific string in their names:
`cargo {{[t|test]}} {{test_name}}`
2020-08-30 01:00:03 -03:00
- Set the number of simultaneous running test cases:
`cargo {{[t|test]}} -- --test-threads {{count}}`
2020-08-30 01:00:03 -03:00
- Test artifacts in release mode, with optimizations:
`cargo {{[t|test]}} {{[-r|--release]}}`
2020-08-30 01:00:03 -03:00
- Test all packages in the workspace:
`cargo {{[t|test]}} --workspace`
2020-08-30 01:00:03 -03:00
2023-10-29 09:54:53 +01:00
- Run tests for a specific package:
2020-08-30 01:00:03 -03:00
`cargo {{[t|test]}} {{[-p|--package]}} {{package}}`
- Run tests without hiding output from test executions:
`cargo {{[t|test]}} -- --nocapture`