跳到主要内容

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

浏览文件

fuzz_test.go

39 行 · 1.1 KB历史下载
1// SPDX-FileCopyrightText: Copyright The Lima Authors
2// SPDX-License-Identifier: Apache-2.0
3
4package store
5
6import (
7 "os"
8 "path/filepath"
9 "testing"
10
11 "gotest.tools/v3/assert"
12
13 "github.com/lima-vm/lima/v2/pkg/limatype/filenames"
14)
15
16func FuzzLoadYAMLByFilePath(f *testing.F) {
17 f.Fuzz(func(t *testing.T, fileContents []byte) {
18 localFile := filepath.Join(t.TempDir(), "yaml_file.yml")
19 err := os.WriteFile(localFile, fileContents, 0o600)
20 assert.NilError(t, err)
21 _, _ = LoadYAMLByFilePath(t.Context(), localFile)
22 })
23}
24
25func FuzzInspect(f *testing.F) {
26 f.Fuzz(func(t *testing.T, yml, limaVersion []byte) {
27 limaDir := t.TempDir()
28 t.Setenv("LIMA_HOME", limaDir)
29 err := os.MkdirAll(filepath.Join(limaDir, "fuzz-instance"), 0o700)
30 assert.NilError(t, err)
31 ymlFile := filepath.Join(limaDir, "fuzz-instance", filenames.LimaYAML)
32 limaVersionFile := filepath.Join(limaDir, filenames.LimaVersion)
33 err = os.WriteFile(ymlFile, yml, 0o600)
34 assert.NilError(t, err)
35 err = os.WriteFile(limaVersionFile, limaVersion, 0o600)
36 assert.NilError(t, err)
37 _, _ = Inspect(t.Context(), "fuzz-instance")
38 })
39}