Skip to content

Commit

Permalink
add test to import-blocklist
Browse files Browse the repository at this point in the history
  • Loading branch information
mfederowicz committed Dec 14, 2023
1 parent 825dcbe commit cec76c7
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions test/import-blocklist_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package test

import (
"testing"

"github.com/mgechev/revive/lint"
"github.com/mgechev/revive/rule"
)

func TestImportsBlocklistOriginal(t *testing.T) {
args := []any{"crypto/md5", "crypto/sha1"}

testRule(t, "imports-blocklist-original", &rule.ImportsBlocklistRule{}, &lint.RuleConfig{
Arguments: args,
})
}

func TestImportsBlocklist(t *testing.T) {
args := []any{"github.com/full/match", "wildcard/**/between", "wildcard/backward/**", "**/wildcard/forward", "full"}

testRule(t, "imports-blocklist", &rule.ImportsBlocklistRule{}, &lint.RuleConfig{
Arguments: args,
})
}

func BenchmarkImportsBlocklist(b *testing.B) {
args := []any{"github.com/full/match", "wildcard/**/between", "wildcard/backward/**", "**/wildcard/forward", "full"}
var t *testing.T
for i := 0; i <= b.N; i++ {
testRule(t, "imports-blocklist", &rule.ImportsBlocklistRule{}, &lint.RuleConfig{
Arguments: args,
})
}
}

0 comments on commit cec76c7

Please sign in to comment.