x07-test
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesex07-test
x07-test
This skill provides the single canonical way to run tests for an X07 project using the built-in test harness.
该Skill提供了使用内置测试工具集运行X07项目测试的标准统一方式。
Canonical command
标准命令
x07 test --manifest tests/tests.json
x07 test --manifest tests/tests.json
Notes
注意事项
- By default, prints JSON to stdout; use
x07 testto write a report file.--report-out <path> - Filter selection:
x07 test --manifest tests/tests.json --filter <substr>x07 test --manifest tests/tests.json --filter <id> --exact- By default, filters that select 0 tests are an error; pass to treat this as success.
--allow-empty - Use to print selected tests without running them.
--list
- Progress output:
- prints
x07 test --verboselines to stderr while preserving the machine report on stdout.test: <id>
- Fuel overrides:
- Set on a test entry in
solve_fuelto override the per-test fuel cap.tests/tests.json
- Set
- Runner traps:
- When a runner traps, the report includes diagnostic with
X07T_RUN_TRAPset to the decoded trap string.details.trap
- When a runner traps, the report includes diagnostic
- OS-world working directory:
- For /
run-os, the runner processrun-os-sandboxedis derived from the manifest directory when possible (sandboxed tests may choose a differentcwdto satisfy policy read roots), so relative filesystem paths resolve from thatcwd.cwd
- For
- Property-based tests (PBT):
- runs PBT entries only.
x07 test --pbt --manifest tests/tests.json - runs unit + PBT.
x07 test --all --manifest tests/tests.json - replays exactly one counterexample.
x07 test --pbt --pbt-repro <repro.json> --manifest tests/tests.json - If PBT finds a counterexample, use to convert it into a deterministic regression test (wrapper module + manifest entry).
x07 fix --from-pbt <repro.json> --write
- resolves
x07 testby searching upward from the manifest directory, then upward from thestdlib.lockexecutable location. Override withx07.--stdlib-lock <path> - New projects created with include
x07 initplus a minimaltests/tests.json.tests/smoke.x07.json - Publishable package repos created with include
x07 init --packageand publishable modules undertests/tests.json(nomodules/).tests/smoke.x07.json - Tests under can import your project modules via project module-root discovery (typically
tests/in projects, andsrc/in package repos).modules/ - World-gating is enforced at compile time. Keep unit tests small and pure (no filesystem/network I/O) unless you are explicitly writing OS-world integration tests and running them under the sandbox profile.
- 默认情况下,会将JSON输出到标准输出;使用
x07 test参数可将报告写入文件。--report-out <path> - 测试筛选:
x07 test --manifest tests/tests.json --filter <substr>x07 test --manifest tests/tests.json --filter <id> --exact- 默认情况下,若筛选后无测试用例则视为错误;传递参数可将此情况视为成功。
--allow-empty - 使用参数可打印选中的测试用例但不执行。
--list
- 进度输出:
- 会将
x07 test --verbose行输出到标准错误流,同时在标准输出流保留机器可读报告。test: <id>
- Fuel上限覆盖:
- 在的测试条目里设置
tests/tests.json,可覆盖单测试用例的Fuel上限。solve_fuel
- 在
- 运行器陷阱:
- 当运行器触发陷阱时,报告中会包含诊断信息,其中
X07T_RUN_TRAP会设置为解码后的陷阱字符串。details.trap
- 当运行器触发陷阱时,报告中会包含诊断信息
- 操作系统环境工作目录:
- 对于/
run-os,运行器进程的run-os-sandboxed会尽可能从清单目录派生(沙箱测试可能会选择不同的cwd以满足策略读取根目录要求),因此相对文件系统路径会从该cwd解析。cwd
- 对于
- 基于属性的测试(PBT):
- 仅运行PBT测试条目。
x07 test --pbt --manifest tests/tests.json - 会运行单元测试+PBT测试。
x07 test --all --manifest tests/tests.json - 会精确重放一个反例。
x07 test --pbt --pbt-repro <repro.json> --manifest tests/tests.json - 若PBT发现反例,可使用将其转换为确定性回归测试(包含包装器模块+清单条目)。
x07 fix --from-pbt <repro.json> --write
- 会从清单目录向上搜索
x07 test,若未找到则从stdlib.lock可执行文件位置向上搜索。可使用x07参数手动指定路径。--stdlib-lock <path> - 使用创建的新项目会包含
x07 init以及一个基础的tests/tests.json。tests/smoke.x07.json - 使用创建的可发布包仓库会包含
x07 init --package,且可发布模块位于tests/tests.json目录下(无modules/)。tests/smoke.x07.json - 目录下的测试可通过项目模块根目录发现机制导入项目模块(项目中通常为
tests/目录,包仓库中通常为src/目录)。modules/ - World-gating会在编译时强制执行。请保持单元测试小巧且纯函数式(无文件系统/网络I/O),除非你明确要编写OS-world集成测试并在沙箱配置下运行它们。