writeTempFile writes content to a temporary file and returns its path.
(t *testing.T, content string)
| 10 | |
| 11 | // writeTempFile writes content to a temporary file and returns its path. |
| 12 | func 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 | |
| 21 | func TestLoadBackgroundFileNotFound(t *testing.T) { |
| 22 | _, err := loadBackgroundFile(filepath.Join(t.TempDir(), "does-not-exist.md")) |
no outgoing calls
no test coverage detected