TestLoop_LogFile tests that log file is created and written to.
(t *testing.T)
| 305 | |
| 306 | // TestLoop_LogFile tests that log file is created and written to. |
| 307 | func TestLoop_LogFile(t *testing.T) { |
| 308 | tmpDir := t.TempDir() |
| 309 | _ = createTestPRD(t, tmpDir, true) |
| 310 | |
| 311 | logPath := filepath.Join(tmpDir, "claude.log") |
| 312 | logFile, err := os.OpenFile(logPath, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0644) |
| 313 | if err != nil { |
| 314 | t.Fatalf("Failed to create log file: %v", err) |
| 315 | } |
| 316 | |
| 317 | l := NewLoop(filepath.Join(tmpDir, "prd.md"), "test", 1, testProvider) |
| 318 | l.logFile = logFile |
| 319 | |
| 320 | l.logLine("test log line") |
| 321 | logFile.Close() |
| 322 | |
| 323 | // Read back the log file |
| 324 | data, err := os.ReadFile(logPath) |
| 325 | if err != nil { |
| 326 | t.Fatalf("Failed to read log file: %v", err) |
| 327 | } |
| 328 | |
| 329 | if string(data) != "test log line\n" { |
| 330 | t.Errorf("Expected log line content, got %q", string(data)) |
| 331 | } |
| 332 | } |
| 333 | |
| 334 | // TestLoop_ChiefDoneEvent tests detection of <chief-done/> event. |
| 335 | func TestLoop_ChiefDoneEvent(t *testing.T) { |
nothing calls this directly
no test coverage detected