Test and validation workflow before commit
# Full validation (format + clippy + test)
./.agent/skills/testing/scripts/validate.sh
# With auto-fix formatting
./.agent/skills/testing/scripts/validate.sh --fix
cargo fmt --all
Automatically formats all code according to Rust conventions.
cargo clippy --all-targets -- -D warnings
Rules:
#[allow(...)]cargo test
Rules:
When writing #[tokio::test], preventing infinite hangs is critical:
recv().await).// ❌ Potential hang
let msg = rx.recv().await.unwrap();
// ✅ Safe
let msg = tokio::time::timeout(std::time::Duration::from_secs(1), rx.recv())
.await
.expect("Timeout waiting for message")?;
cargo build --release
Do this before a release or to verify optimizations.
# Full validation in one line
cargo fmt && cargo clippy --all-targets -- -D warnings && cargo test
# Specific tests
cargo test test_name # A specific test
cargo test module_name:: # All tests in a module
cargo test --lib # Library tests only
cargo test --test integration # Integration tests
cargo fmt executedcargo clippy without warningscargo test all tests pass