(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 := range 12 { |
| 149 | for _, provider := range providers { |
| 150 | workers.Go(func() { |
| 151 | side := "new" |
| 152 | if iteration%2 == 0 { |
| 153 | side = "old" |
| 154 | } |
| 155 | args := comparisonArgs(provider.Tool().Name()) |
| 156 | args["side"] = side |
| 157 | got, err := provider.Execute(context.Background(), args) |
| 158 | if err != nil { |
| 159 | test.Error(err) |
| 160 | return |
| 161 | } |
| 162 | want := side + "-marker" |
| 163 | if provider.Tool() == FileFind { |
| 164 | want = "after.txt" |
| 165 | if side == "old" { |
| 166 | want = "before.txt" |
| 167 | } |
| 168 | } |
| 169 | if !strings.Contains(got, want) { |
| 170 | test.Errorf("%s/%s: %q lacks %q", provider.Tool().Name(), side, got, want) |
| 171 | } |
| 172 | }) |
| 173 | } |
| 174 | } |
| 175 | workers.Wait() |
| 176 | } |
| 177 | |
| 178 | func TestCodeAccessEmptyAndMissingTrees(test *testing.T) { |
| 179 | current, previous := comparisonReaders(test) |
nothing calls this directly
no test coverage detected