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

Function writeTempFile

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

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

Calls

no outgoing calls

Tested by

no test coverage detected