一键导入
rust-tests-guidelines
Guidelines for writing Rust tests in OpenFirma.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Guidelines for writing Rust tests in OpenFirma.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Review Rust changes for correctness, robustness, documentation quality, and test coverage.
Write Rust tests for OpenFirma crates while avoiding redundant coverage.
Review changes ahead of opening a new PR, modifying an existing one or on demand by the user.
Edit a pre-existing GitHub pull request for OpenFirma. Use whenever you are asked to make changes to commits, branches or bookmarks that would affect an open GitHub PR.
Open a GitHub pull request for OpenFirma. Use whenever you are asked to open a PR.
Dirty repo, uncommitted changes, commit, amend, split, changeset, PR history: inspect repository state and prepare atomic Git commits or jj changesets. Use whenever the worktree is already dirty or you are about to commit or rewrite history.
| name | rust-tests-guidelines |
| description | Guidelines for writing Rust tests in OpenFirma. |
Guidelines for writing new tests for Rust code.
proptest where property-based coverage adds real value for invariants or parser-like behavior.Test an error's structure and its user-visible rendering when both are part of the contract. Prefer the following assertion strategy at each boundary:
assert_matches! to verify the variant and any
meaningful fields, then use an inline insta::assert_snapshot! on
error.to_string() when the message is user-visible.anyhow errors, downcast and verify the typed source. Snapshot
format!("{error:#}") only when the complete error chain is what a user
sees; error.to_string() may contain only an outer context message.stderr
with only narrowly scoped redactions of nondeterministic values, and retain
separate assertions for important ordering or side-effect invariants.Avoid bare .is_err(), matches!(error, Variant { .. }), and
message.contains(...) when a stable variant, meaningful fields, or the full
user-visible message can be asserted. Substring checks remain useful as
supplementary assertions for ordering and absence guarantees.
When adding an error variant or changing a user-visible error message, inspect the affected tests for both structural coverage and rendered-message coverage.
.snap.new or .pending-snap artifacts in the working copy.tests/ integration suites.#[cfg(test)] modules or inline tests to src/ files.