1
0
mirror of https://github.com/mgechev/revive.git synced 2024-11-24 08:32:22 +02:00
revive/test/import-blocklist_test.go
Marcin Federowicz 9abe06adfa
refactor: rename blacklist to blocklist and whitelist to allowlist (#946)
* refactor: rename blacklist to blocklist and whitelist to allowlist
2024-01-15 12:16:00 +01:00

35 lines
912 B
Go

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,
})
}
}