跳到主要内容

Claude Cage · 面向 Claude 的隔离开发环境,支持桌面工作台、多账号、远程部署与移动端连接。上游 Lee-xeo/Claude-Cage 完整源码镜像,非灵栈原创;主许可 MIT,第三方组件遵循各自许可。来源:https://github.com/Lee-xeo/Claude-Cage 。手动同步,不附带 Release 安装包。

浏览文件

guest_os_test.go

30 行 · 920 B历史下载
1package main
2
3import (
4 "bytes"
5 "runtime"
6 "strings"
7 "testing"
8)
9
10func TestGuestOSVMIDRequiresExplicitValidTarget(t *testing.T) {
11 const valid = "ad2d0746-c50c-4dbd-a5f3-495ccfa4cbc2"
12 for _, args := range [][]string{
13 {"--json", "--vm-id", "this is not a GUID"},
14 {"--json", "--vm-id", "00000000-0000-0000-0000-000000000000"},
15 {"--vm-id", valid},
16 {"--json", "--vm-id", valid, "--vm-id", valid},
17 } {
18 var out bytes.Buffer
19 if err := writeGuestOSInspection(t.Context(), args, &out); err == nil || out.Len() != 0 {
20 t.Fatalf("unexpected guest inspection for %v: %v, %q", args, err, out.String())
21 }
22 }
23 if runtime.GOOS != "windows" {
24 var out bytes.Buffer
25 err := writeGuestOSInspection(t.Context(), []string{"--json", "--vm-id", valid}, &out)
26 if err == nil || !strings.Contains(err.Error(), "Windows") || out.Len() != 0 {
27 t.Fatalf("unexpected non-Windows lookup: %v, %q", err, out.String())
28 }
29 }
30}