Example: Parallel golden file updates
(t *testing.T)
| 72 | |
| 73 | // Example: Parallel golden file updates |
| 74 | func TestParallelUpdates(t *testing.T) { |
| 75 | // When running with -update, files are updated in parallel by default |
| 76 | files := map[string]string{} |
| 77 | for i := 1; i <= 4; i++ { |
| 78 | files[fmt.Sprintf("parallel%d.golden", i)] = generateParallel(i) |
| 79 | } |
| 80 | |
| 81 | for golden, actual := range files { |
| 82 | gf := testutil.NewGoldenFile(t, "testdata/golden") |
| 83 | gf.StringContent(actual).Path(golden).CompareContent() |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | // Helper functions for examples |
| 88 | func generateServiceCode() string { |
nothing calls this directly
no test coverage detected