跳到主要内容

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

浏览文件

macos_password_darwin_test.go

37 行 · 1.2 KB历史下载
1package guestos
2
3import (
4 "os"
5 "os/exec"
6 "path/filepath"
7 "testing"
8)
9
10// Exercise the shipping native password policy without granting host permissions.
11func TestMacPasswordAcceptsVerifiedSettingsExtensions(t *testing.T) {
12 dir := t.TempDir()
13 harness := `import AppKit
14struct Failure: Error {
15 let code: Int
16 let message: String
17 init(_ code: Int, _ message: String) { self.code = code; self.message = message }
18}
19func requireGuest() throws { throw Failure(1,"unused") }
20func consoleUser() throws { throw Failure(1,"unused") }
21@main struct Check {
22 @MainActor static func main() throws { try MacSetupPassword.selfTest() }
23}
24`
25 input := filepath.Join(dir, "check.swift")
26 if err := os.WriteFile(input, []byte(harness), 0600); err != nil {
27 t.Fatal(err)
28 }
29 program := filepath.Join(dir, "password-check")
30 source := filepath.Join("..", "..", "scripts", "guest-os", "macos-setup-password.swift")
31 if output, err := exec.CommandContext(t.Context(), "xcrun", "swiftc", "-parse-as-library", source, input, "-o", program).CombinedOutput(); err != nil {
32 t.Fatalf("compile password policy: %v\n%s", err, output)
33 }
34 if output, err := exec.CommandContext(t.Context(), program).CombinedOutput(); err != nil {
35 t.Fatalf("password policy: %v\n%s", err, output)
36 }
37}