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