闲社服务运行正常AI智能体自动化平台
s

Swift测试代码审查

技能标识:swift-testing-code-review

Reviews Swift Testing code for proper use of #expect/#require, parameterized tests, async testing, and organization. Use when reviewing .swift files with import Testing, @Test, #expect, @Suite, or confirmation patterns.

作者:admin | 来源记录:ClawHub
登记来源
ClawHub
版本
V 1.2.0
检测标记
后台标记通过
免费
免费获取
0
收藏
来源与检测标记为平台登记信息,并不代表已展示可复核的检测报告。使用前请核对版本、依赖和所需权限,建议先在隔离环境中运行。
概述
安装方式
版本历史

Swift测试代码审查

Swift 测试代码审查

快速参考

问题类型参考文档
#expect 与 #require、表达式捕获、错误测试references/expect-macro.md
带参数的 @Test、特性、zip() 陷阱
references/parameterized.md | | confirmation、异步序列、完成处理器 | references/async-testing.md | | @Suite、标签、并行执行、.serialized | references/organization.md |

审查清单

  • - [ ] 表达式直接嵌入在 #expect 中(而非预先计算的布尔值)
  • [ ] #require 仅用于前置条件,#expect 用于断言
  • [ ] 错误测试检查特定类型(而非泛型 (any Error).self)
  • [ ] 使用 zip() 的参数化测试对(而非笛卡尔积)
  • [ ] 参数化预期值中不包含镜像实现的逻辑
  • [ ] 使用 confirmation(expectedCount:) 测试异步序列
  • [ ] 完成处理器使用 withCheckedContinuation,而非 confirmation
  • [ ] 仅在必要时应用 .serialized(共享资源)
  • [ ] 互斥的兄弟序列化套件嵌套在父套件下
  • [ ] 不假设 @Test 函数之间的状态持久性
  • [ ] 禁用的测试附有说明和 Bug 链接

何时加载参考文档

  • - 审查 #expect 或 #require 用法 -> expect-macro.md
  • 审查带参数或特性的 @Test -> parameterized.md
  • 审查 confirmation 或异步测试 -> async-testing.md
  • 审查 @Suite 或测试组织 -> organization.md

审查问题

  1. 1. #expect 中的预计算布尔值是否会丢失诊断上下文?
  2. #require 是否过早停止测试,而非揭示所有失败?
  3. 多参数参数化测试是否意外产生了笛卡尔积?
  4. zip() 是否会因数组长度不相等而静默丢弃测试用例?
  5. 完成处理器是否被错误地使用 confirmation 进行测试?

标签

skill ai

通过对话安装

以下为平台配置的接入选项,并非逐项实测通过。能否安装取决于客户端支持、技能来源和运行环境:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 swift-testing-code-review-1776110242 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 swift-testing-code-review-1776110242 技能

通过命令行安装

skillhub install swift-testing-code-review-1776110242

下载

⬇ 下载 swift-testing-code-review v1.2.0(免费)

文件大小: 8.61 KB | 发布时间: 2026-4-14 12:10

v1.2.0 最新 2026-4-14 12:10
Version 1.2.0 introduces a clear reference and checklist system for Swift Testing code reviews.

- Added quick reference table mapping common test code issues to specific guidance documents.
- Provided a detailed checklist for consistent code review, covering expectations, async patterns, and test organization.
- Included contextual advice on when to consult each reference during reviews.
- Added review questions to spotlight common pitfalls and best practices.
返回顶部