x07-test

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

x07-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,
    x07 test
    prints JSON to stdout; use
    --report-out <path>
    to write a report file.
  • 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
      --allow-empty
      to treat this as success.
    • Use
      --list
      to print selected tests without running them.
  • Progress output:
    • x07 test --verbose
      prints
      test: <id>
      lines to stderr while preserving the machine report on stdout.
  • Fuel overrides:
    • Set
      solve_fuel
      on a test entry in
      tests/tests.json
      to override the per-test fuel cap.
  • Runner traps:
    • When a runner traps, the report includes diagnostic
      X07T_RUN_TRAP
      with
      details.trap
      set to the decoded trap string.
  • OS-world working directory:
    • For
      run-os
      /
      run-os-sandboxed
      , the runner process
      cwd
      is derived from the manifest directory when possible (sandboxed tests may choose a different
      cwd
      to satisfy policy read roots), so relative filesystem paths resolve from that
      cwd
      .
  • Property-based tests (PBT):
    • x07 test --pbt --manifest tests/tests.json
      runs PBT entries only.
    • x07 test --all --manifest tests/tests.json
      runs unit + PBT.
    • x07 test --pbt --pbt-repro <repro.json> --manifest tests/tests.json
      replays exactly one counterexample.
    • If PBT finds a counterexample, use
      x07 fix --from-pbt <repro.json> --write
      to convert it into a deterministic regression test (wrapper module + manifest entry).
  • x07 test
    resolves
    stdlib.lock
    by searching upward from the manifest directory, then upward from the
    x07
    executable location. Override with
    --stdlib-lock <path>
    .
  • New projects created with
    x07 init
    include
    tests/tests.json
    plus a minimal
    tests/smoke.x07.json
    .
  • Publishable package repos created with
    x07 init --package
    include
    tests/tests.json
    and publishable modules under
    modules/
    (no
    tests/smoke.x07.json
    ).
  • Tests under
    tests/
    can import your project modules via project module-root discovery (typically
    src/
    in projects, and
    modules/
    in package repos).
  • 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.
  • 默认情况下,
    x07 test
    会将JSON输出到标准输出;使用
    --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
      的测试条目里设置
      solve_fuel
      ,可覆盖单测试用例的Fuel上限。
  • 运行器陷阱:
    • 当运行器触发陷阱时,报告中会包含诊断信息
      X07T_RUN_TRAP
      ,其中
      details.trap
      会设置为解码后的陷阱字符串。
  • 操作系统环境工作目录:
    • 对于
      run-os
      /
      run-os-sandboxed
      ,运行器进程的
      cwd
      会尽可能从清单目录派生(沙箱测试可能会选择不同的
      cwd
      以满足策略读取根目录要求),因此相对文件系统路径会从该
      cwd
      解析。
  • 基于属性的测试(PBT):
    • x07 test --pbt --manifest tests/tests.json
      仅运行PBT测试条目。
    • x07 test --all --manifest tests/tests.json
      会运行单元测试+PBT测试。
    • 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集成测试并在沙箱配置下运行它们。