github.com/chenfeining/golangci-lint@v1.0.2-0.20230730162517-14c6c67868df/test/testdata/thelper.go (about)

     1  //golangcitest:args -Ethelper
     2  package testdata
     3  
     4  import "testing"
     5  
     6  func thelperWithHelperAfterAssignment(t *testing.T) { // want "test helper function should start from t.Helper()"
     7  	_ = 0
     8  	t.Helper()
     9  }
    10  
    11  func thelperWithNotFirst(s string, t *testing.T, i int) { // want `parameter \*testing.T should be the first`
    12  	t.Helper()
    13  }
    14  
    15  func thelperWithIncorrectName(o *testing.T) { // want `parameter \*testing.T should have name t`
    16  	o.Helper()
    17  }
    18  
    19  func bhelperWithHelperAfterAssignment(b *testing.B) { // want "test helper function should start from b.Helper()"
    20  	_ = 0
    21  	b.Helper()
    22  }
    23  
    24  func bhelperWithNotFirst(s string, b *testing.B, i int) { // want `parameter \*testing.B should be the first`
    25  	b.Helper()
    26  }
    27  
    28  func bhelperWithIncorrectName(o *testing.B) { // want `parameter \*testing.B should have name b`
    29  	o.Helper()
    30  }
    31  
    32  func tbhelperWithHelperAfterAssignment(tb testing.TB) { // want "test helper function should start from tb.Helper()"
    33  	_ = 0
    34  	tb.Helper()
    35  }
    36  
    37  func tbhelperWithNotFirst(s string, tb testing.TB, i int) { // want `parameter testing.TB should be the first`
    38  	tb.Helper()
    39  }
    40  
    41  func tbhelperWithIncorrectName(o testing.TB) { // want `parameter testing.TB should have name tb`
    42  	o.Helper()
    43  }
    44  
    45  func TestSubtestShouldNotBeChecked(t *testing.T) {
    46  	testCases := []struct {
    47  		desc string
    48  	}{
    49  		{
    50  			desc: "example",
    51  		},
    52  	}
    53  
    54  	for _, test := range testCases {
    55  		test := test
    56  		t.Run(test.desc, func(t *testing.T) {
    57  			t.Parallel()
    58  
    59  			t.Error("test")
    60  		})
    61  	}
    62  }