MCPcopy
hub / github.com/expr-lang/expr / TestDiffRace

Function TestDiffRace

internal/testify/assert/assertions_test.go:2411–2442  ·  view source on GitHub ↗

Ensure there are no data races

(t *testing.T)

Source from the content-addressed store, hash-verified

2409
2410// Ensure there are no data races
2411func TestDiffRace(t *testing.T) {
2412 t.Parallel()
2413
2414 expected := map[string]string{
2415 "a": "A",
2416 "b": "B",
2417 "c": "C",
2418 }
2419
2420 actual := map[string]string{
2421 "d": "D",
2422 "e": "E",
2423 "f": "F",
2424 }
2425
2426 // run diffs in parallel simulating tests with t.Parallel()
2427 numRoutines := 10
2428 rChans := make([]chan string, numRoutines)
2429 for idx := range rChans {
2430 rChans[idx] = make(chan string)
2431 go func(ch chan string) {
2432 defer close(ch)
2433 ch <- diff(expected, actual)
2434 }(rChans[idx])
2435 }
2436
2437 for _, ch := range rChans {
2438 for msg := range ch {
2439 NotZero(t, msg) // dummy assert
2440 }
2441 }
2442}
2443
2444type mockTestingT struct {
2445 errorFmt string

Callers

nothing calls this directly

Calls 2

diffFunction · 0.85
NotZeroFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…