| 155 | } |
| 156 | |
| 157 | func TestBodyMaxLineLen_Fail(t *testing.T) { |
| 158 | r := &rule.BodyMaxLineLenRule{} |
| 159 | if err := r.Apply(lint.RuleSetting{Argument: 20}); err != nil { |
| 160 | t.Fatal(err) |
| 161 | } |
| 162 | issue, ok := r.Validate(&mockCommit{body: "Short.\nThis line is definitely longer than twenty characters."}) |
| 163 | if ok { |
| 164 | t.Error("line > 20 should fail") |
| 165 | } |
| 166 | if issue == nil || len(issue.Infos()) == 0 { |
| 167 | t.Error("expected infos with per-line detail") |
| 168 | } |
| 169 | } |
| 170 | |
| 171 | func TestBodyMaxLineLen_EmptyBody(t *testing.T) { |
| 172 | r := &rule.BodyMaxLineLenRule{} |