(t *testing.T)
| 177 | } |
| 178 | |
| 179 | func TestLoadRunSummaryInvalidJSON(t *testing.T) { |
| 180 | // Create a temporary directory for testing |
| 181 | tmpDir := testutil.TempDir(t, "test-*") |
| 182 | runDir := filepath.Join(tmpDir, "run-12345") |
| 183 | if err := os.MkdirAll(runDir, 0755); err != nil { |
| 184 | t.Fatalf("Failed to create test directory: %v", err) |
| 185 | } |
| 186 | |
| 187 | // Write invalid JSON to the summary file |
| 188 | summaryPath := filepath.Join(runDir, runSummaryFileName) |
| 189 | if err := os.WriteFile(summaryPath, []byte("invalid json {"), 0644); err != nil { |
| 190 | t.Fatalf("Failed to write invalid JSON: %v", err) |
| 191 | } |
| 192 | |
| 193 | // Try to load the invalid summary |
| 194 | loadedSummary, ok := loadRunSummary(runDir, false) |
| 195 | if ok { |
| 196 | t.Fatal("Expected loadRunSummary to return false for invalid JSON, but it returned true") |
| 197 | } |
| 198 | if loadedSummary != nil { |
| 199 | t.Errorf("Expected nil summary for invalid JSON, but got: %+v", loadedSummary) |
| 200 | } |
| 201 | } |
| 202 | |
| 203 | func TestListArtifacts(t *testing.T) { |
| 204 | // Create a temporary directory structure for testing |
nothing calls this directly
no test coverage detected