github.com/gwaycc/gometalinter@v3.0.0+incompatible/regressiontests/goconst_test.go (about) 1 package regressiontests 2 3 import "testing" 4 5 func TestGoconst(t *testing.T) { 6 t.Parallel() 7 source := `package test 8 func a() { 9 foo := "bar" 10 } 11 func b() { 12 bar := "bar" 13 } 14 ` 15 expected := Issues{ 16 {Linter: "goconst", Severity: "warning", Path: "test.go", Line: 3, Col: 9, Message: `1 other occurrence(s) of "bar" found in: test.go:6:9`}, 17 {Linter: "goconst", Severity: "warning", Path: "test.go", Line: 6, Col: 9, Message: `1 other occurrence(s) of "bar" found in: test.go:3:9`}, 18 } 19 ExpectIssues(t, "goconst", source, expected, "--min-occurrences", "2") 20 }