agentsclimarketplace

Rust tests guidelines

Skill ComeOnOliver/skillshub/skills/RediSearch/RediSearch/rust-tests-guidelines

🧠 The right skill, one API call. AI agent skills registry with token-efficient skill resolution. 5,000+ skills from 500+ top repos.

Install
npx -y skills add ComeOnOliver/skillshub --skill rust-tests-guidelines

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

SKILL.md

1.3 KB, 310 tokens by cl100k_base, as published. Nobody here has run it

Guidelines for Writing Rust Tests

Guidelines for writing new tests for Rust code.

Guidelines

  1. Test against the public API of the code under test.
  2. Test private APIs if and only if the private component is highly complex and difficult to test through the public API.
  3. Use insta whenever you are testing output that is difficult to predict or compare.
  4. Where appropriate, use proptest to add property-based tests for key invariants.
  5. Testing code should be written with the same care reserved to production code. Avoid unnecessary duplication, introduce helpers to reduce boilerplate and ensure readability. The intent of a test should be obvious or, if not possible, clearly documented.
  6. Do not reference exact line numbers in comments, as they may change over time.

Code organization

  1. Put tests under the tests directory of the relevant crate if they don't rely on private APIs.
  2. The tests directory should be organized as a crate, with a main.rs file and all tests in modules. Refer to the trie_rs/tests directory as an example.
  3. If the test must rely on private APIs, co-locate them with the code they test, using a #[cfg(test)] module.

Dealing with extern C symbols

Check out CONTRIBUTING.md for instructions on how to deal with undefined C symbols in Rust tests.

What ships with it

Read from the repository

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

Keep looking

Skills are one crate of 328,083. 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.