1
0
mirror of https://github.com/mgechev/revive.git synced 2025-05-21 22:13:14 +02:00
revive/test/context_as_argument_test.go

30 lines
779 B
Go
Raw Normal View History

package test
import (
"testing"
"github.com/mgechev/revive/lint"
"github.com/mgechev/revive/rule"
)
func TestContextAsArgumentDefault(t *testing.T) {
testRule(t, "context_as_argument_default", &rule.ContextAsArgumentRule{}, &lint.RuleConfig{})
}
func TestContextAsArgument(t *testing.T) {
testRule(t, "context_as_argument", &rule.ContextAsArgumentRule{}, &lint.RuleConfig{
Arguments: []any{
map[string]any{
"allowTypesBefore": "AllowedBeforeType,AllowedBeforeStruct,*AllowedBeforePtrStruct,*testing.T",
},
},
})
testRule(t, "context_as_argument", &rule.ContextAsArgumentRule{}, &lint.RuleConfig{
Arguments: []any{
map[string]any{
"allow-types-before": "AllowedBeforeType,AllowedBeforeStruct,*AllowedBeforePtrStruct,*testing.T",
},
},
})
}