mirror of
https://github.com/mgechev/revive.git
synced 2025-11-23 22:04:49 +02:00
refactor: reduce control nesting in AddConstantRule.configure (#1128)
This commit is contained in:
@@ -7,16 +7,18 @@ import (
|
||||
"github.com/mgechev/revive/rule"
|
||||
)
|
||||
|
||||
func TestAddConstant(t *testing.T) {
|
||||
args := []any{map[string]any{
|
||||
"maxLitCount": "2",
|
||||
"allowStrs": "\"\"",
|
||||
"allowInts": "0,1,2",
|
||||
"allowFloats": "0.0,1.0",
|
||||
"ignoreFuncs": "os\\.(CreateFile|WriteFile|Chmod|FindProcess),\\.Println,ignoredFunc,\\.Info",
|
||||
}}
|
||||
func TestAddConstantWithDefaultArguments(t *testing.T) {
|
||||
testRule(t, "add_constant_default", &rule.AddConstantRule{}, &lint.RuleConfig{})
|
||||
}
|
||||
|
||||
func TestAddConstantWithArguments(t *testing.T) {
|
||||
testRule(t, "add_constant", &rule.AddConstantRule{}, &lint.RuleConfig{
|
||||
Arguments: args,
|
||||
Arguments: []any{map[string]any{
|
||||
"maxLitCount": "2",
|
||||
"allowStrs": "\"\"",
|
||||
"allowInts": "0,1,2",
|
||||
"allowFloats": "0.0,1.0",
|
||||
"ignoreFuncs": "os\\.(CreateFile|WriteFile|Chmod|FindProcess),\\.Println,ignoredFunc,\\.Info",
|
||||
}},
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user