(test *testing.T)
| 147 | } |
| 148 | |
| 149 | func TestCodeAccessConcurrentSides(test *testing.T) { |
| 150 | current, previous := comparisonReaders(test) |
| 151 | access, err := NewComparisonCodeAccess(current, previous) |
| 152 | if err != nil { |
| 153 | test.Fatal(err) |
| 154 | } |
| 155 | providers := comparisonProviders(¤t, access) |
| 156 | var workers sync.WaitGroup |
| 157 | for iteration := range 12 { |
| 158 | for _, provider := range providers { |
| 159 | workers.Go(func() { |
| 160 | side := "new" |
| 161 | if iteration%2 == 0 { |
| 162 | side = "old" |
| 163 | } |
| 164 | args := comparisonArgs(provider.Tool().Name()) |
| 165 | args["side"] = side |
| 166 | got, err := provider.Execute(context.Background(), args) |
| 167 | if err != nil { |
| 168 | test.Error(err) |
| 169 | return |
| 170 | } |
| 171 | want := side + "-marker" |
| 172 | if provider.Tool() == FileFind { |
| 173 | want = "after.txt" |
| 174 | if side == "old" { |
| 175 | want = "before.txt" |
| 176 | } |
| 177 | } |
| 178 | if !strings.Contains(got, want) { |
| 179 | test.Errorf("%s/%s: %q lacks %q", provider.Tool().Name(), side, got, want) |
| 180 | } |
| 181 | }) |
| 182 | } |
| 183 | } |
| 184 | workers.Wait() |
| 185 | } |
| 186 | |
| 187 | func TestCodeAccessEmptyAndMissingTrees(test *testing.T) { |
| 188 | current, previous := comparisonReaders(test) |
nothing calls this directly
no test coverage detected