(t *testing.T)
| 9 | ) |
| 10 | |
| 11 | func TestProcessFile(t *testing.T) { |
| 12 | t.Parallel() |
| 13 | |
| 14 | tests := []struct { |
| 15 | name string |
| 16 | input string |
| 17 | expected string |
| 18 | }{ |
| 19 | { |
| 20 | name: "adds t.Parallel to multiple tests", |
| 21 | input: `package foo_test |
| 22 | |
| 23 | import "testing" |
| 24 | |
| 25 | func TestFoo(t *testing.T) { |
| 26 | t.Log("foo") |
| 27 | } |
| 28 | |
| 29 | func TestBar(t *testing.T) { |
| 30 | t.Log("bar") |
| 31 | } |
| 32 | `, |
| 33 | expected: `package foo_test |
| 34 | |
| 35 | import "testing" |
| 36 | |
| 37 | func TestFoo(t *testing.T) { |
| 38 | t.Parallel() |
| 39 | t.Log("foo") |
| 40 | } |
| 41 | |
| 42 | func TestBar(t *testing.T) { |
| 43 | t.Parallel() |
| 44 | t.Log("bar") |
| 45 | } |
| 46 | `, |
| 47 | }, |
| 48 | { |
| 49 | name: "skips test that already has t.Parallel", |
| 50 | input: `package foo_test |
| 51 | |
| 52 | import "testing" |
| 53 | |
| 54 | func TestFoo(t *testing.T) { |
| 55 | t.Parallel() |
| 56 | t.Log("hello") |
| 57 | } |
| 58 | `, |
| 59 | expected: `package foo_test |
| 60 | |
| 61 | import "testing" |
| 62 | |
| 63 | func TestFoo(t *testing.T) { |
| 64 | t.Parallel() |
| 65 | t.Log("hello") |
| 66 | } |
| 67 | `, |
| 68 | }, |
nothing calls this directly
no test coverage detected