2018-07-17 21:21:27 +02:00
|
|
|
package test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/mgechev/revive/lint"
|
|
|
|
"github.com/mgechev/revive/rule"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestAddConstant(t *testing.T) {
|
2023-09-24 08:44:02 +02:00
|
|
|
args := []any{map[string]any{
|
2018-07-17 21:21:27 +02:00
|
|
|
"maxLitCount": "2",
|
|
|
|
"allowStrs": "\"\"",
|
|
|
|
"allowInts": "0,1,2",
|
|
|
|
"allowFloats": "0.0,1.0",
|
2024-07-19 10:33:27 +02:00
|
|
|
"ignoreFuncs": "os\\.(CreateFile|WriteFile|Chmod|FindProcess),\\.Println,ignoredFunc,\\.Info",
|
2018-07-17 21:21:27 +02:00
|
|
|
}}
|
|
|
|
|
|
|
|
testRule(t, "add-constant", &rule.AddConstantRule{}, &lint.RuleConfig{
|
|
|
|
Arguments: args,
|
|
|
|
})
|
|
|
|
}
|