mirror of
https://github.com/mgechev/revive.git
synced 2025-11-25 22:12:38 +02:00
feature: new rule enforce-switch-default (#1390)
This commit is contained in:
21
test/enforce_switch_style_test.go
Normal file
21
test/enforce_switch_style_test.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/mgechev/revive/lint"
|
||||
"github.com/mgechev/revive/rule"
|
||||
)
|
||||
|
||||
func TestEnforceSwitchStyle(t *testing.T) {
|
||||
testRule(t, "enforce_switch_style", &rule.EnforceSwitchStyleRule{})
|
||||
testRule(t, "enforce_switch_style_allow_no_default", &rule.EnforceSwitchStyleRule{}, &lint.RuleConfig{
|
||||
Arguments: []any{"allowNoDefault"},
|
||||
})
|
||||
testRule(t, "enforce_switch_style_allow_not_last", &rule.EnforceSwitchStyleRule{}, &lint.RuleConfig{
|
||||
Arguments: []any{"allowDefaultNotLast"},
|
||||
})
|
||||
testRule(t, "enforce_switch_style_allow_no_default_allow_not_last", &rule.EnforceSwitchStyleRule{}, &lint.RuleConfig{
|
||||
Arguments: []any{"allowNoDefault", "allowDefaultNotLast"},
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user