Shared spell
Cursor testing rule for Rust
This configuration is stored in the URL. Change a setting and copy a new link. Nothing is saved on a server.
Loading the generator…
Shared spell
This configuration is stored in the URL. Change a setting and copy a new link. Nothing is saved on a server.
Loading the generator…
---
description: "Testing rules for a Rust repository"
globs: "**/tests.rs"
alwaysApply: false
---
# Testing rules
Attach these rules when editing tests in this Rust repository.
The always-on project rule still lives in `.cursor/rules/project.mdc`. This file does not repeat it.
## Stack
This repository is a Rust crate on Cargo. Format with rustfmt, lint with cargo clippy, and use Result for recoverable failure.
## Commands
- Test: `cargo test`
- Format: `cargo fmt`
- Lint: `cargo clippy --all-targets -- -D warnings`
- Build: `cargo build`
Use the script the repo already defines when it differs from the command above.
## Testing
Write a failing test before production code.
Write a failing `#[test]` that expects the Result you want, then implement. Include the error case in the same change.
## Done when
- The requested behavior works.
- `cargo test` passes. Run `cargo clippy --all-targets -- -D warnings` when the change is more than a comment.
- The diff stays inside the task.
- You list anything you could not run.