2022-06-18 18:47:53 +02:00
|
|
|
package test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/mgechev/revive/internal/typeparams"
|
2024-09-23 12:38:39 +02:00
|
|
|
"github.com/mgechev/revive/lint"
|
2022-06-18 18:47:53 +02:00
|
|
|
"github.com/mgechev/revive/rule"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestReceiverNamingTypeParams(t *testing.T) {
|
|
|
|
if !typeparams.Enabled() {
|
|
|
|
t.Skip("type parameters are not enabled in the current build environment")
|
|
|
|
}
|
|
|
|
testRule(t, "receiver-naming-issue-669", &rule.ReceiverNamingRule{})
|
|
|
|
}
|
2024-09-23 12:38:39 +02:00
|
|
|
|
|
|
|
func TestReceiverNamingMaxLength(t *testing.T) {
|
|
|
|
args := []any{map[string]any{
|
|
|
|
"maxLength": int64(2),
|
|
|
|
}}
|
|
|
|
testRule(t, "receiver-naming-issue-1040", &rule.ReceiverNamingRule{},
|
|
|
|
&lint.RuleConfig{Arguments: args})
|
|
|
|
}
|