1
0
mirror of https://github.com/mgechev/revive.git synced 2025-02-01 13:07:44 +02:00
revive/test/unhandled-error_test.go
Buyanov Vladimir 7b1458a9cb
fix #754 [rule.unhandled-error] change arguments to regexp (#757)
* fix #754 [rule.unhandled-error] change arguments to regexp

* Update unhandled-error-w-ignorelist.go

* Update unhandled-error_test.go

* Update unhandled-error-w-ignorelist.go

* adds config backward compatibility test

* fix #754 [rule.unhandled-error] change arguments to regexp

* fix #754 [rule.unhandled-error] change arguments to regexp

* fix #754 [rule.unhandled-error] change arguments to regexp

Co-authored-by: chavacava <salvadorcavadini+github@gmail.com>
2022-11-09 13:13:52 +01:00

26 lines
556 B
Go

package test
import (
"testing"
"github.com/mgechev/revive/lint"
"github.com/mgechev/revive/rule"
)
func TestUnhandledError(t *testing.T) {
testRule(t, "unhandled-error", &rule.UnhandledErrorRule{})
}
func TestUnhandledErrorWithIgnoreList(t *testing.T) {
args := []interface{}{
`unhandledError1`,
`fmt\.Print`,
`os\.(Create|WriteFile|Chmod)`,
`net\..*`,
`bytes\.Buffer\.Write`,
`fixtures\.unhandledErrorStruct2\.reterr`,
}
testRule(t, "unhandled-error-w-ignorelist", &rule.UnhandledErrorRule{}, &lint.RuleConfig{Arguments: args})
}