Adding case-sensitive exclude processor

Signed-off-by: Maciej "Iwan" Iwanowski <maciej.iwanowski@critical.today>
This commit is contained in:
Maciej "Iwan" Iwanowski 2020-04-22 18:40:10 +02:00
parent 4958e50dfe
commit a68b411e4a
No known key found for this signature in database
GPG key ID: 2484258A4DD3EE84
5 changed files with 49 additions and 4 deletions

View file

@ -51,3 +51,21 @@ func TestExclude(t *testing.T) {
func TestNoExclude(t *testing.T) {
processAssertSame(t, NewExclude(""), newTextIssue("test"))
}
func TestExcludeCaseSensitive(t *testing.T) {
p := NewExcludeCaseSensitive("^exclude$")
texts := []string{"excLude", "1", "", "exclud", "exclude"}
var issues []result.Issue
for _, t := range texts {
issues = append(issues, newTextIssue(t))
}
processedIssues := process(t, p, issues...)
assert.Len(t, processedIssues, len(issues)-1)
var processedTexts []string
for _, i := range processedIssues {
processedTexts = append(processedTexts, i.Text)
}
assert.Equal(t, texts[:len(texts)-1], processedTexts)
}