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

Function writeTempFile

cmd/opencodereview/background_file_test.go:15–22  ·  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

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

Calls

no outgoing calls

Tested by

no test coverage detected