ZI

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.zip

Installs 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 模块单测时。
169 charsno explicit “when” trigger
Intermediate

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

You give it
A Jass module `Xxx.j`
You get back
Unit test files (`Xxx.cfg`, `Xxx_Test.j`) and test logic

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. 建立三件套文件

  1. 以目标模块 Xxx.j 为中心,确认同目录存在:Xxx.cfgXxx_Test.j
  2. Xxx.cfg 不存在时创建,并补齐:公开 API 关键词 + [chain] 基础依赖。
  3. 需要物编辅助测试时,按需创建同名扩展文件:Xxx.w3a(技能)、Xxx.w3u(单位)、Xxx.w3i(物品)。

说明:cfg 前半段用于外部 dependency 注入关键词;[chain] 是该库底层依赖,用于递归注入。

2. 生成或刷新 _Test.j(必须走任务脚本)

优先复用项目脚本,不手写测试壳。

  1. 运行:bash .codex/skills/zinc-unittest/scripts/create_ut.sh <Xxx.j>
  2. 该流程会调用 Lua/tasks/TaskCreateUT.lua,并使用模板 Jass/template/UTTemplate.j
  3. 已存在 _Test.j 时默认不覆盖,仅更新 Jass/config/UnitTest.h 的 include 到当前测试文件。

如果脚本不可用,再手动按 UTTemplate.j 结构补齐占位符:{UnitTest}LibraryName#include

3. 编写测试逻辑(参考 UnitUtils 风格)

  1. library UTXxx requires Xxx,... 中按功能拆分 Test_* 私有函数。
  2. 使用 UnitTestAutoTimer 安排自动测试,避免初始化竞争。
  3. 聊天命令入口走 s1..s10-参数,复用模板函数 TTestUTXxx* / TTestActUTXxx1
  4. 断言优先使用 UnitTestFramwork.assertBoolean/Integer/Real/String
  5. 需要输出到日志时优先用 Trace(...)(YDLua),不要依赖仅本地可见的原生提示。

4. 宏保护与命名

  1. 测试专用注册与入口放在测试文件中;若写在业务库,必须加:#if (CURRENT_BUILD_VERSION != VERSION_RELEASE)
  2. 不使用 _ 开头标识符。
  3. 用模块名前缀组织测试名与提示文案,保证日志可检索。

5. 验收检查

  1. Xxx.cfg 关键词覆盖公开能力;[chain] 不漏基础库。
  2. _Test.j 可独立触发核心断言,失败日志能定位到具体测试。
  3. 若依赖物编,Xxx.w3a/w3u/w3i 与测试步骤匹配,并在说明中写出用途。

References(按需加载)

  • references/ut-file-layout.md
  • references/assert-trace-pattern.md
  • references/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.

SkillInstallsUpdatedSafetyDifficulty
zinc-unittest (this skill)06moReviewIntermediate
reduce-unoptimized-query-oracle16moReviewAdvanced
differential-fuzzer16moReviewIntermediate
fix-pr01moNo flagsAdvanced

Try saying

Example prompts that trigger this skill in your AI assistant.

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.

13

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

12

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

00

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.

1683

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.

789

sqlite-inspector

mikopbx

Проверка консистентности данных в SQLite баз данных MikoPBX после операций REST API. Использовать при валидации результатов API, отладке проблем с данными, проверке связей внешних ключей или инспектировании CDR записей для тестирования.

568

Search skills

Search the agent skills registry