MCPcopy Create free account
hub / github.com/alibaba/open-code-review / writeTempFile

Function writeTempFile

cmd/opencodereview/background_file_test.go:12–19  ·  view source on GitHub ↗

writeTempFile writes content to a temporary file and returns its path.

(t *testing.T, content string)

Source from the content-addressed store, hash-verified

10
11// writeTempFile writes content to a temporary file and returns its path.
12func writeTempFile(t *testing.T, content string) string {
13 t.Helper()
14 path := filepath.Join(t.TempDir(), "background.md")
15 if err := os.WriteFile(path, []byte(content), 0o600); err != nil {
16 t.Fatalf("write temp file: %v", err)
17 }
18 return path
19}
20
21func TestLoadBackgroundFileNotFound(t *testing.T) {
22 _, err := loadBackgroundFile(filepath.Join(t.TempDir(), "does-not-exist.md"))

Calls

no outgoing calls

Tested by

no test coverage detected