Skip to content

test(security): add tests for Sandbox interface and NoopSandbox | 测试(sandbox): 添加 Sandbox 接口测试#751

Merged
DonPrus merged 3 commits intonullclaw:mainfrom
manelsen:test/sandbox
Apr 10, 2026
Merged

test(security): add tests for Sandbox interface and NoopSandbox | 测试(sandbox): 添加 Sandbox 接口测试#751
DonPrus merged 3 commits intonullclaw:mainfrom
manelsen:test/sandbox

Conversation

@manelsen
Copy link
Copy Markdown
Contributor

Summary

EN:

Add 8 unit tests for src/security/sandbox.zig, closing the zero-test coverage gap in the Sandbox abstraction layer.

ZH:

src/security/sandbox.zig 添加 8 个单元测试,消除 Sandbox 抽象层的零测试覆盖空白。

What changed

EN:

  • src/security/sandbox.zig: added 8 tests covering:
    • NoopSandbox.isAvailable() always returns true
    • NoopSandbox.name() returns "none"
    • NoopSandbox.description() is non-empty
    • NoopSandbox.wrapCommand() passes argv through unchanged
    • NoopSandbox.wrapCommand() handles empty argv
    • Sandbox interface vtable dispatch paths
    • createNoopSandbox() factory returns a functional sandbox
    • SandboxBackend enum exhaustiveness

ZH:

  • src/security/sandbox.zig:新增 8 个测试覆盖:
    • NoopSandbox.isAvailable() 始终返回 true
    • NoopSandbox.name() 返回 "none"
    • NoopSandbox.description() 非空
    • NoopSandbox.wrapCommand() 将 argv 原样传递
    • NoopSandbox.wrapCommand() 处理空 argv
    • Sandbox 接口 vtable 分发路径
    • createNoopSandbox() 工厂返回可用沙箱
    • SandboxBackend 枚举穷举性

Validation

  • zig build test --summary all: 6135/6146 passed (8 new tests added)
  • All sandbox-specific tests pass cleanly

manelsen and others added 3 commits March 30, 2026 22:00
Add 8 tests covering:
- NoopSandbox is always available
- NoopSandbox name and description
- wrapCommand passes argv through unchanged (including empty argv)
- Sandbox interface vtable dispatch paths
- createNoopSandbox factory
- SandboxBackend enum exhaustiveness

Fixes: zero-test coverage gap in security/sandbox.zig.
@DonPrus DonPrus merged commit 9b2944c into nullclaw:main Apr 10, 2026
3 checks passed
@manelsen manelsen deleted the test/sandbox branch April 10, 2026 02:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants