testing-validation
Test and validation workflow before commit
安装与使用
请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。
查看来源 ↗使用指南技能说明
Skill: Testing & Validation
When to use this skill
- BEFORE any commit (mandatory)
- After implementing a feature
- To validate a refactoring
- When in doubt about code quality
Automated script
# Full validation (format + clippy + test)
./.agent/skills/testing/scripts/validate.sh
# With auto-fix formatting
./.agent/skills/testing/scripts/validate.sh --fix
Validation workflow
Step 1: Format
cargo fmt --all
Automatically formats all code according to Rust conventions.
Step 2: Lint
cargo clippy --all-targets -- -D warnings
Rules:
- NO warnings allowed
- Fix clippy suggestions, don't ignore them with
#[allow(...)] - If an allow is really necessary, justify it in a comment
Step 3: Tests
cargo test
Rules:
- All tests must pass
- A failing test = no commit
- New tests should cover edge cases
Step 4: Release verification (optional)
cargo build --release
Do this before a release or to verify optimizations.
Quick commands
# Full validation in one line
cargo fmt && cargo clippy --all-targets -- -D warnings && cargo test
# Specific tests
cargo test test_name # A specific test
cargo test module_name:: # All tests in a module
cargo test --lib # Library tests only
cargo test --test integration # Integration tests
On failure
Clippy warning
- Read the error message carefully
- Apply clippy's suggestion
- If the suggestion is not applicable, justify with a comment
Test failure
- Identify the failing test
- Check if it's a bug in the code or in the test
- NEVER delete a test to make CI pass
- Fix the code or adapt the test if behavior changed intentionally
Checklist before commit
-
cargo fmtexecuted -
cargo clippywithout warnings -
cargo testall tests pass - Documentation updated (if needed)
- GLOBAL_APP_DESCRIPTION.md updated (if new feature)
- Version incremented in Cargo.toml
使用示例
查看来源仓库中的使用示例与配置说明。
查看来源 ↗来源历史
- 收录时间
- 2026-01-20
- 索引更新时间
- 2026-02-03
- Branch
- main
收录与同步日期属于本站记录。源码修改历史请查看来源仓库。
GitHub ↗chat Comments (0)
Sign in to join the discussion and leave a comment.
No comments yet. Be the first to share your thoughts!