Skip to content

Commit 1e5cd60

Browse files
committed
bump github.com/kulti/thelper from 0.5.1 to 0.6.0
1 parent bb7731f commit 1e5cd60

File tree

5 files changed

+36
-5
lines changed

5 files changed

+36
-5
lines changed

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ require (
4646
github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af
4747
github.com/julz/importas v0.1.0
4848
github.com/kisielk/errcheck v1.6.0
49-
github.com/kulti/thelper v0.5.1
49+
github.com/kulti/thelper v0.6.0
5050
github.com/kunwardeep/paralleltest v1.0.3
5151
github.com/kyoh86/exportloopref v0.1.8
5252
github.com/ldez/gomoddirectives v0.2.2

go.sum

+2-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/config/linters_settings.go

+5
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,11 @@ type ThelperSettings struct {
549549
Name bool `mapstructure:"name"`
550550
Begin bool `mapstructure:"begin"`
551551
} `mapstructure:"test"`
552+
Fuzz struct {
553+
First bool `mapstructure:"first"`
554+
Name bool `mapstructure:"name"`
555+
Begin bool `mapstructure:"begin"`
556+
} `mapstructure:"fuzz"`
552557
Benchmark struct {
553558
First bool `mapstructure:"first"`
554559
Name bool `mapstructure:"name"`

pkg/golinters/thelper.go

+10
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,16 @@ func NewThelper(cfg *config.ThelperSettings) *goanalysis.Linter {
2727
opts = append(opts, "t_first")
2828
}
2929

30+
if cfg.Fuzz.Name {
31+
opts = append(opts, "f_name")
32+
}
33+
if cfg.Fuzz.Begin {
34+
opts = append(opts, "f_begin")
35+
}
36+
if cfg.Fuzz.First {
37+
opts = append(opts, "f_first")
38+
}
39+
3040
if cfg.Benchmark.Name {
3141
opts = append(opts, "b_name")
3242
}

test/testdata/thelper.go

+18
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,19 @@ func thelperWithIncorrectName(o *testing.T) { // ERROR `parameter \*testing.T sh
1616
o.Helper()
1717
}
1818

19+
func fhelperWithHelperAfterAssignment(f *testing.F) { // ERROR "test helper function should start from f.Helper()"
20+
_ = 0
21+
f.Helper()
22+
}
23+
24+
func fhelperWithNotFirst(s string, f *testing.F, i int) { // ERROR `parameter \*testing.F should be the first`
25+
f.Helper()
26+
}
27+
28+
func fhelperWithIncorrectName(o *testing.F) { // ERROR `parameter \*testing.F should have name f`
29+
o.Helper()
30+
}
31+
1932
func bhelperWithHelperAfterAssignment(b *testing.B) { // ERROR "test helper function should start from b.Helper()"
2033
_ = 0
2134
b.Helper()
@@ -60,3 +73,8 @@ func TestSubtestShouldNotBeChecked(t *testing.T) {
6073
})
6174
}
6275
}
76+
77+
func FuzzSubtestShouldNotBeChecked(f *testing.F) {
78+
f.Add(5, "hello")
79+
f.Fuzz(func(t *testing.T, a int, b string) {})
80+
}

0 commit comments

Comments
 (0)