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

     1  package processors
     2  
     3  import (
     4  	"go/token"
     5  	"testing"
     6  
     7  	"github.com/golangci/golangci-lint/pkg/result"
     8  )
     9  
    10  func newFLIssue(file string, line int) result.Issue {
    11  	return result.Issue{
    12  		Pos: token.Position{
    13  			Filename: file,
    14  			Line:     line,
    15  		},
    16  	}
    17  }
    18  
    19  func TestUniqByLine(t *testing.T) {
    20  	p := NewUniqByLine()
    21  	i1 := newFLIssue("f1", 1)
    22  
    23  	processAssertSame(t, p, i1)
    24  	processAssertEmpty(t, p, i1) // check skipping
    25  	processAssertEmpty(t, p, i1) // check accumulated error
    26  
    27  	processAssertSame(t, p, newFLIssue("f1", 2)) // another line
    28  	processAssertSame(t, p, newFLIssue("f2", 1)) // another file
    29  }