1
0
mirror of https://github.com/mgechev/revive.git synced 2025-11-23 22:04:49 +02:00
Files
revive/test/defer_test.go

28 lines
701 B
Go
Raw Normal View History

package test_test
2020-05-24 20:49:49 +02:00
import (
"testing"
"github.com/mgechev/revive/lint"
"github.com/mgechev/revive/rule"
)
func TestDefer(t *testing.T) {
testRule(t, "defer", &rule.DeferRule{})
}
func TestDeferLoopDisabled(t *testing.T) {
testRule(t, "defer_loop_disabled", &rule.DeferRule{}, &lint.RuleConfig{
Arguments: []any{[]any{"return", "recover", "callChain", "methodCall"}},
})
testRule(t, "defer_loop_disabled", &rule.DeferRule{}, &lint.RuleConfig{
Arguments: []any{[]any{"return", "recover", "call-chain", "method-call"}},
2020-05-24 20:49:49 +02:00
})
}
func TestDeferOthersDisabled(t *testing.T) {
testRule(t, "defer_only_loop_enabled", &rule.DeferRule{}, &lint.RuleConfig{
Arguments: []any{[]any{"loop"}},
2020-05-24 20:49:49 +02:00
})
}