跳到主要内容

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

浏览文件

autostart_darwin_test.go

30 行 · 1.2 KB历史下载
1// SPDX-FileCopyrightText: Copyright The Lima Authors
2// SPDX-License-Identifier: Apache-2.0
3
4package main
5
6import (
7 "strings"
8 "testing"
9
10 "gotest.tools/v3/assert"
11)
12
13// The daemon plist is rendered from a map, and text/template turns a key the template
14// references but the map omits into the literal string "<no value>" instead of failing.
15// That would be written into /Library/LaunchDaemons verbatim, so assert that the rendered
16// plist carries the real LIMA_HOME and no placeholder.
17func TestRenderDaemonPlist(t *testing.T) {
18 t.Setenv("LIMA_HOME", "/some/lima/home")
19 for _, keepAlive := range []bool{false, true} {
20 got, err := renderDaemonPlist("/limactl", "colima", "/some/path", "containerserver", keepAlive)
21 assert.NilError(t, err)
22 plist := string(got)
23 assert.Assert(t, !strings.Contains(plist, "<no value>"),
24 "plist has an unresolved template key:\n%s", plist)
25 assert.Assert(t, strings.Contains(plist, "<key>LIMA_HOME</key>\n\t\t<string>/some/lima/home</string>"),
26 "plist does not carry LIMA_HOME:\n%s", plist)
27 assert.Assert(t, strings.Contains(plist, "<string>containerserver</string>"))
28 assert.Equal(t, strings.Contains(plist, "<key>KeepAlive</key>"), keepAlive)
29 }
30}