1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-21 22:22:07 +02:00
tldr/pages/common/cargo-test.md
Lena 554fd30c20
cargo, cargo-{build,check,doc,run,test}: add option placeholders (#15895)
Co-authored-by: Darío Hereñú <magallania@gmail.com>
2025-03-15 23:28:32 +02:00

710 B

cargo test

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}}

  • Set the number of simultaneous running test cases:

cargo {{[t|test]}} -- --test-threads {{count}}

  • Test artifacts in release mode, with optimizations:

cargo {{[t|test]}} {{[-r|--release]}}

  • Test all packages in the workspace:

cargo {{[t|test]}} --workspace

  • Run tests for a specific package:

cargo {{[t|test]}} {{[-p|--package]}} {{package}}

  • Run tests without hiding output from test executions:

cargo {{[t|test]}} -- --nocapture