github.com/gwaycc/gometalinter@v3.0.0+incompatible/regressiontests/gochecknoglobals_test.go (about)

     1  package regressiontests
     2  
     3  import "testing"
     4  
     5  func TestGochecknoglobals(t *testing.T) {
     6  	t.Parallel()
     7  	source := `package test
     8  
     9  	var _ = 1
    10  
    11  	const constant = 2
    12  
    13  	var globalVar = 3
    14  
    15  	func function() int {
    16  		var localVar = 4
    17  		return localVar
    18  	}
    19  `
    20  	expected := Issues{
    21  		{Linter: "gochecknoglobals", Severity: "warning", Path: "test.go", Line: 7, Message: "globalVar is a global variable"},
    22  	}
    23  	ExpectIssues(t, "gochecknoglobals", source, expected)
    24  }