zinc-unittest
Standardizes unit testing for War3Lib Zinc modules, covering test shells, configuration, and assertions.
Install
mkdir -p .claude/skills/zinc-unittest && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/12517" && unzip -o skill.zip -d .claude/skills/zinc-unittest && rm skill.zipInstalls to .claude/skills/zinc-unittest
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
War3Lib 的 Zinc 单元测试流程规范(.j + .cfg + _Test.j + 可选 w3a/w3u/w3i):使用 TaskCreateUT.lua 生成测试壳、维护 cfg 注入与 chain 依赖、使用 UnitTestFramwork.assert 断言与 Trace 日志输出。用于创建/重构 Jass 模块单测时。Key capabilities
- →Establish three essential files for unit testing: `.j`, `.cfg`, `_Test.j`
- →Create or update `.cfg` with public API keywords and chain dependencies
- →Generate or refresh `_Test.j` using a task script
- →Write test logic using `Test_*` private functions and `UnitTestFramwork.assert`
- →Protect test-specific registrations with `#if (CURRENT_BUILD_VERSION != VERSION_RELEASE)`
- →Verify `Xxx.cfg` covers public capabilities and `_Test.j` can trigger assertions
How it works
The skill guides the creation and refactoring of Zinc unit tests for War3Lib Jass modules by establishing required files, generating test shells, and structuring test logic with assertions and logging.
Inputs & outputs
When to use zinc-unittest
- →Creating unit tests for Jass modules
- →Refactoring game logic with tests
- →Debugging game systems
About this skill
Zinc Unit Test Workflow (War3Lib)
按以下顺序执行,保持最小改动和可复现。
1. 建立三件套文件
- 以目标模块
Xxx.j为中心,确认同目录存在:Xxx.cfg、Xxx_Test.j。 Xxx.cfg不存在时创建,并补齐:公开 API 关键词 +[chain]基础依赖。- 需要物编辅助测试时,按需创建同名扩展文件:
Xxx.w3a(技能)、Xxx.w3u(单位)、Xxx.w3i(物品)。
说明:cfg 前半段用于外部 dependency 注入关键词;[chain] 是该库底层依赖,用于递归注入。
2. 生成或刷新 _Test.j(必须走任务脚本)
优先复用项目脚本,不手写测试壳。
- 运行:
bash .codex/skills/zinc-unittest/scripts/create_ut.sh <Xxx.j>。 - 该流程会调用
Lua/tasks/TaskCreateUT.lua,并使用模板Jass/template/UTTemplate.j。 - 已存在
_Test.j时默认不覆盖,仅更新Jass/config/UnitTest.h的 include 到当前测试文件。
如果脚本不可用,再手动按 UTTemplate.j 结构补齐占位符:{UnitTest}、LibraryName、#include。
3. 编写测试逻辑(参考 UnitUtils 风格)
- 在
library UTXxx requires Xxx,...中按功能拆分Test_*私有函数。 - 使用
UnitTestAutoTimer安排自动测试,避免初始化竞争。 - 聊天命令入口走
s1..s10或-参数,复用模板函数TTestUTXxx*/TTestActUTXxx1。 - 断言优先使用
UnitTestFramwork.assert:Boolean/Integer/Real/String。 - 需要输出到日志时优先用
Trace(...)(YDLua),不要依赖仅本地可见的原生提示。
4. 宏保护与命名
- 测试专用注册与入口放在测试文件中;若写在业务库,必须加:
#if (CURRENT_BUILD_VERSION != VERSION_RELEASE)。 - 不使用
_开头标识符。 - 用模块名前缀组织测试名与提示文案,保证日志可检索。
5. 验收检查
Xxx.cfg关键词覆盖公开能力;[chain]不漏基础库。_Test.j可独立触发核心断言,失败日志能定位到具体测试。- 若依赖物编,
Xxx.w3a/w3u/w3i与测试步骤匹配,并在说明中写出用途。
References(按需加载)
references/ut-file-layout.mdreferences/assert-trace-pattern.mdreferences/examples.md
When not to use it
- →When not working with War3Lib Zinc unit tests
- →When the module is not Jass
- →When not creating or refactoring Jass module unit tests
Limitations
- →The skill is specific to War3Lib Zinc unit tests
- →It requires specific file naming conventions
- →It relies on `TaskCreateUT.lua` and `UTTemplate.j` for test shell generation
How it compares
This skill provides a structured workflow for Zinc unit testing in War3Lib, including specific file setup, script-based test shell generation, and assertion patterns, unlike general unit testing approaches.
Compared to similar skills
zinc-unittest side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| zinc-unittest (this skill) | 0 | 6mo | Review | Intermediate |
| reduce-unoptimized-query-oracle | 1 | 6mo | Review | Advanced |
| differential-fuzzer | 1 | 6mo | Review | Intermediate |
| fix-pr | 0 | 1mo | No flags | Advanced |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by Crainax
View all by Crainax →You might also like
reduce-unoptimized-query-oracle
cockroachdb
Reduce an unoptimized-query-oracle test failure log to the simplest possible reproduction case. Use when you have unoptimized-query-oracle*.log files from a failed roachtest and need to find the minimal SQL to reproduce the bug.
differential-fuzzer
tursodatabase
Information about the differential fuzzer tool, how to run it and use it catch bugs in Turso. Always load this skill when running this tool
fix-pr
questdb
Validate and fix pasted QuestDB pull-request review findings one at a time, with claim verification, a failing regression test where feasible, robust and performant implementation, testing, and an independent review/fix loop. Use when Codex is asked to fix Critical, Moderate, or other actionable PR
testing-workflow
amo-tech-ai
Comprehensive testing workflow for E2E, integration, and unit tests. Use when testing applications layer-by-layer, validating user journeys, or running test suites.
web3-testing
wshobson
Test smart contracts comprehensively using Hardhat and Foundry with unit tests, integration tests, and mainnet forking. Use when testing Solidity contracts, setting up blockchain test suites, or validating DeFi protocols.
sqlite-inspector
mikopbx
Проверка консистентности данных в SQLite баз данных MikoPBX после операций REST API. Использовать при валидации результатов API, отладке проблем с данными, проверке связей внешних ключей или инспектировании CDR записей для тестирования.