1
0
mirror of https://github.com/mgechev/revive.git synced 2025-01-26 03:52:12 +02:00
revive/rule/argument-limit_test.go
2018-01-21 18:04:41 -08:00

35 lines
568 B
Go

package rule
import (
"testing"
"github.com/mgechev/revive/rule"
"github.com/mgechev/revive/testutil"
)
func TestArgumentLimit(t *testing.T) {
t.Parallel()
program := `
package foo
[@1]func foo(a int, b int, c int)[/@1] {
return a + b + c;
}
`
testutil.AssertFailures(t, program, &ArgumentsLimitRule{}, rule.Arguments{"2"})
}
func TestArgumentLimit2(t *testing.T) {
t.Parallel()
program := `
package foo
func foo(a int, b int, c int) {
return a + b + c;
}
`
testutil.AssertSuccess(t, program, &ArgumentsLimitRule{}, rule.Arguments{"3"})
}