github.com/ldez/golangci-lint@v1.10.1/pkg/result/processors/max_per_file_from_linter_test.go (about)

     1  package processors
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/golangci/golangci-lint/pkg/result"
     7  )
     8  
     9  func newFromLinterIssue(linterName string) result.Issue {
    10  	return result.Issue{
    11  		FromLinter: linterName,
    12  	}
    13  }
    14  
    15  func TestMaxPerFileFromLinterUnlimited(t *testing.T) {
    16  	p := NewMaxPerFileFromLinter()
    17  	gosimple := newFromLinterIssue("gosimple")
    18  	processAssertSame(t, p, gosimple) // collect stat
    19  	processAssertSame(t, p, gosimple) // check not limits
    20  }
    21  
    22  func TestMaxPerFileFromLinter(t *testing.T) {
    23  	p := NewMaxPerFileFromLinter()
    24  	for _, name := range []string{"gofmt", "goimports"} {
    25  		limited := newFromLinterIssue(name)
    26  		gosimple := newFromLinterIssue("gosimple")
    27  		processAssertSame(t, p, limited)
    28  		processAssertSame(t, p, gosimple)
    29  		processAssertEmpty(t, p, limited)
    30  	}
    31  }