mirror of
https://github.com/mgechev/revive.git
synced 2024-11-21 17:16:40 +02:00
refactor: simplify tests (#1089)
This commit is contained in:
parent
0fc9613257
commit
6228ba57cf
@ -18,7 +18,7 @@ func TestReviveCreateInstance(t *testing.T) {
|
||||
t.Fatal("Expected MaxOpenFiles to be 2048")
|
||||
}
|
||||
|
||||
if revive.lintingRules == nil || len(revive.lintingRules) == 0 {
|
||||
if len(revive.lintingRules) == 0 {
|
||||
t.Fatal("Linting rules not loaded.")
|
||||
}
|
||||
|
||||
|
@ -40,9 +40,7 @@ func testRule(t *testing.T, filename string, rule lint.Rule, config ...*lint.Rul
|
||||
}
|
||||
|
||||
func assertSuccess(t *testing.T, baseDir string, fi os.FileInfo, rules []lint.Rule, config map[string]lint.RuleConfig) error {
|
||||
l := lint.New(func(file string) ([]byte, error) {
|
||||
return os.ReadFile(file)
|
||||
}, 0)
|
||||
l := lint.New(os.ReadFile, 0)
|
||||
|
||||
filePath := filepath.Join(baseDir, fi.Name())
|
||||
ps, err := l.Lint([][]string{{filePath}}, rules, lint.Config{
|
||||
@ -63,9 +61,7 @@ func assertSuccess(t *testing.T, baseDir string, fi os.FileInfo, rules []lint.Ru
|
||||
}
|
||||
|
||||
func assertFailures(t *testing.T, baseDir string, fi os.FileInfo, src []byte, rules []lint.Rule, config map[string]lint.RuleConfig) error {
|
||||
l := lint.New(func(file string) ([]byte, error) {
|
||||
return os.ReadFile(file)
|
||||
}, 0)
|
||||
l := lint.New(os.ReadFile, 0)
|
||||
|
||||
ins := parseInstructions(t, filepath.Join(baseDir, fi.Name()), src)
|
||||
if ins == nil {
|
||||
|
Loading…
Reference in New Issue
Block a user