github.com/golangci/go-tools@v0.0.0-20190318060251-af6baa5dc196/lint/lint_test.go (about) 1 package lint_test 2 3 import ( 4 "testing" 5 6 . "github.com/golangci/go-tools/lint" 7 "github.com/golangci/go-tools/lint/testutil" 8 ) 9 10 type testChecker struct{} 11 12 func (testChecker) Name() string { return "stylecheck" } 13 func (testChecker) Prefix() string { return "TEST" } 14 func (testChecker) Init(prog *Program) {} 15 16 func (testChecker) Checks() []Check { 17 return []Check{ 18 {ID: "TEST1000", FilterGenerated: false, Fn: testLint}, 19 } 20 } 21 22 func testLint(j *Job) { 23 // Flag all functions 24 for _, fn := range j.Program.InitialFunctions { 25 if fn.Synthetic == "" { 26 j.Errorf(fn, "This is a test problem") 27 } 28 } 29 } 30 31 func TestAll(t *testing.T) { 32 c := testChecker{} 33 testutil.TestAll(t, c, "") 34 }