agentsclimarketplace

Cargo test

Skill G1Joshi/Agent-Skills/skills/testing/cargo-test

Cargo test for Rust testing. Use for Rust testing.From its SKILL.md

Install
npx -y skills add G1Joshi/Agent-Skills --skill cargo-test

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 10 stars10 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

1.6 KB, 428 tokens by cl100k_base, as published. Nobody here has run it

Cargo Test

Rust treats testing as a first-class citizen. cargo test runs unit tests (in the same file), integration tests (in tests/), and uniquely, Documentation Tests (code blocks in your doc comments).

When to Use

  • Rust Projects: The standard.
  • Library Design: Doc tests ensure your examples in README/Docs actually compile and work.

Quick Start

// lib.rs
pub fn add(a: i32, b: i32) -> i32 {
    a + b
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn it_works() {
        assert_eq!(add(2, 2), 4);
    }
}

Core Concepts

Unit vs Integration

  • Unit: Inside src/lib.rs (or same file). Can test private functions.
  • Integration: Inside tests/*.rs. Can only use the public API (like a real user).

Doc Tests

Code blocks in /// comments are run as tests.

/// Adds two numbers.
/// ```
/// let result = my_crate::add(2, 3);
/// assert_eq!(result, 5);
/// ```
pub fn add...

Assertions

assert!, assert_eq!, assert_ne!. #[should_panic] for testing errors.

Best Practices (2025)

Do:

  • Use insta: For snapshot testing in Rust (cargo-insta).
  • Use rstest: For fixture-based and parameterized testing (Pytest style).
  • Test concurrency: Rust's ownership model makes testing concurrent code safer, but still verify with loom for atomics.

Don't:

  • Don't test implementation details in integration tests: Keep tests/ folder for Public API contracts only.

References

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Gives 0 of the 12 instructions most test skills give in 428 tokens

Counted across 964 of the 1,571 authors here whose files we hold, read 2026-08-07

  • Close the browser when donein 55 of 964, across 12 files
  • Wait for network idle statein 51 of 964, across 6 files
  • Launch Chromium in headless modein 49 of 964, across 6 files
  • Use descriptive selectors for elementsin 49 of 964, across 6 files
  • Run provided scripts with help flag firstin 49 of 964, across 6 files
  • Add appropriate explicit waitsin 48 of 964, across 5 files
  • Use bundled scripts as black boxesin 46 of 964, across 3 files
  • Do not read script source codein 46 of 964, across 3 files
  • Use sync playwright for scriptsin 46 of 964, across 3 files
  • Inspect dom before executing actionsin 46 of 964, across 3 files
  • Run the full test suitein 37 of 964
  • Write the failing test firstin 29 of 964, across 23 files

Said here and by no other author read

  • use cargo test for Rust testing
  • write integration tests in the tests folder
  • use doc tests to verify examples compile
  • use insta for snapshot testing
  • test concurrency using loom
  • use assert should_panic for testing errors

Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.

Keep looking

Skills are one crate of 326,871. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.