一键导入
testing
Testing philosophy, coverage workflow, and test generation for the Furst compiler
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Testing philosophy, coverage workflow, and test generation for the Furst compiler
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | testing |
| description | Testing philosophy, coverage workflow, and test generation for the Furst compiler |
| allowed-tools | Read, Edit, Write, Glob, Grep, Bash |
Do not write per-function unit tests. They couple tests to implementation details and break when internals are refactored. Instead, identify the entrypoint functions for each directory/module — typically one or two public functions that everything else feeds through. These are the test boundaries. Test through them.
If a directory has parse, lower, emit as its public API, those are the three boundaries. Everything behind them is implementation detail.
Every test should exercise a language feature, not a function. The test says "this feature works" by feeding representative source code through a boundary and asserting on the output. The set of language features the language supports is the test matrix.
Bad-path tests live separately from happy-path tests. Ideally a separate test project; at minimum separate files in their own subdirectory. Keeping them apart prevents congestion — happy-path tests stay focused on "this feature works" and bad-path tests stay focused on "this invalid input is rejected correctly." Separation lets you run and reason about them independently.
After tests cover all language features through all boundaries, any branch with zero coverage is suspect. Ask: can a language feature exercise this branch? If yes, write the test. If no, it's dead code — remove it. Coverage is not a vanity metric; it's a dead code finder.
Enumerate every feature the language supports (or will support). Group by category: expressions, bindings, functions, modules, types, structs, etc. Each feature is a row. Each boundary it should pass through is a column. The matrix tells you what's tested and what's not.
For each feature, write at least one test through the highest-level boundary that exercises it (prefer end-to-end roundtrip when possible). The test provides source code as input and asserts on structured output. No mocking, no internal state inspection.
For each construct that should be invalid, write a test providing the bad source and asserting on the exact error type and message. Organize by error category: lex errors, parse errors, type errors, symbol errors.
Bad-path test pattern:
input: invalid source string
assert: Result is Error with expected message/type
# run tests with coverage collection
# generate a summary report
# review per-module branch coverage
For each uncovered branch:
Autogenerated code (protobuf, codegen output) should be excluded from coverage targets. It inflates uncovered lines and isn't meaningful to test through feature boundaries.
""") starting on a new line, with the source formatted naturally across multiple lines. This makes tests read like real Furst code, not compressed one-liners.