1
0
mirror of https://github.com/mgechev/revive.git synced 2025-06-04 23:07:22 +02:00
revive/test/exported_test.go
Oleksandr Redko 9f5f957b33
rule: allow lowercased and kebab-cased options (#1272)
* rule: tests for Configure with named options; fix errors

* rule: refactor and add tests for ifelse rules

* rule: allow lowercased and kebab-cased options

* test: update integration tests with lowercased params

* docs: update rules descriptions

* rule: simplify Configure implementation with one option

* gofmt and fix lint

* review: add isRuleOption, update grammar in doc, simplify regex

Co-authored-by: ccoVeille <3875889+ccoVeille@users.noreply.github.com>

---------

Co-authored-by: ccoVeille <3875889+ccoVeille@users.noreply.github.com>
2025-03-28 09:34:20 +01:00

46 lines
1.5 KiB
Go

package test
import (
"testing"
"github.com/mgechev/revive/lint"
"github.com/mgechev/revive/rule"
)
func TestExportedWithDisableStutteringCheck(t *testing.T) {
args := []any{"disableStutteringCheck"}
testRule(t, "exported_issue_555", &rule.ExportedRule{}, &lint.RuleConfig{Arguments: args})
}
func TestExportedWithChecksOnMethodsOfPrivateTypes(t *testing.T) {
args := []any{"checkPrivateReceivers"}
testRule(t, "exported_issue_552", &rule.ExportedRule{}, &lint.RuleConfig{Arguments: args})
}
func TestExportedReplacingStuttersByRepetitive(t *testing.T) {
args := []any{"sayRepetitiveInsteadOfStutters"}
testRule(t, "exported_issue_519", &rule.ExportedRule{}, &lint.RuleConfig{Arguments: args})
}
func TestCheckPublicInterfaceOption(t *testing.T) {
args := []any{"checkPublicInterface"}
testRule(t, "exported_issue_1002", &rule.ExportedRule{}, &lint.RuleConfig{Arguments: args})
}
func TestCheckDisablingOnDeclarationTypes(t *testing.T) {
testRule(t, "exported_issue_1045", &rule.ExportedRule{}, &lint.RuleConfig{
Arguments: []any{"disableChecksOnConstants", "disableChecksOnFunctions", "disableChecksOnMethods", "disableChecksOnTypes", "disableChecksOnVariables"},
})
testRule(t, "exported_issue_1045", &rule.ExportedRule{}, &lint.RuleConfig{
Arguments: []any{"disable-checks-on-constants", "disable-checks-on-functions", "disable-checks-on-methods", "disable-checks-on-types", "disable-checks-on-variables"},
})
}
func TestCheckDirectiveComment(t *testing.T) {
testRule(t, "exported_issue_1202", &rule.ExportedRule{}, &lint.RuleConfig{})
}