Skip to content
Back to skills

Rust Testing

ASecurity

Behavior. Use when writing or reviewing Rust tests: assertions, proving layer, real dependencies, time control, and defect detection.

  • 14 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 2, 2026
developmentrustgotestinggit

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned December 2, 2026

npx -y skills add Dankosik/cargo-modernize --skill rust-testing --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Rust Testing?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Rust Testing
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/dankosik-rust-testing-cargo-modernize/badge)](https://www.skillsdirectory.com/skills/dankosik-rust-testing-cargo-modernize)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: rust-testing
description: "Behavior. Use when writing or reviewing Rust tests: assertions, proving layer, real dependencies, time control, and defect detection."
---

# Rust Testing

**Behavior first.** Name the observable contract a defect would break, select the smallest layer able to watch it fail, and assert concrete user-visible outcomes (reported finding id and span, rendered replacement, `.fixed.rs` output, report JSON, `stderr` bytes, exit code, or untouched working tree) against independent expected values.

**Smallest proving layer.** Match the harness to the boundary under test: unit tests beside pure logic in `cargo-modernize-core`, paired catalog fixtures (`<id>.rs` with `//~ <id>` markers and `<id>.fixed.rs`) plus a negative twin for every rule, metamorphic property tests (`metamorphic_proptest.rs`) for matcher and renderer invariants, and binary-level tests in `crates/cargo-modernize/tests` over `tempfile` workspaces for discovery, MSRV/edition resolution, `--diff`, `--verify`, `--fix`, `--check`, and exit codes. Assert public behavior so internal refactors stay green.

**Real inputs versus doubles.** Exercise real `cargo`, `git`, and parser behavior whenever their semantics belong to the claim (generated workspaces, real repositories for VCS diffs, real `cargo check` for `--verify`/`--fix`); reserve doubles such as the test-only panic detector for injected faults. Cover every supported edition (`2015`–`2024`), `no_std`/`alloc`/`std` variants, MSRV boundaries one release below and at `requires`, and `const` and macro contexts when a rule's admission depends on them.

**Determinism.** Keep output order, paths, and fingerprints independent of thread scheduling, filesystem iteration order, host path separators, and environment; normalize only what the contract declares unstable, and never sleep to synchronize.

**Defect reproduction and discovery.** Organize tests by behavior with small fixtures and explicit boundary limits. Reproduce bugs with a failing test first, verify non-zero executed test counts, and use `cargo mutants`, property tests, Miri, `cargo xtask stress-ui`, or fuzzing selectively as discovery aids rather than mandatory gates.

Files in this skill

  • LICENSE1 KB
  • SKILL.md2.2 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.