| 1080 | } |
| 1081 | |
| 1082 | func TestBodyLeadingBlank_WithoutBlank_Fail(t *testing.T) { |
| 1083 | r := &rule.BodyLeadingBlankRule{} |
| 1084 | if err := r.Apply(lint.RuleSetting{}); err != nil { |
| 1085 | t.Fatal(err) |
| 1086 | } |
| 1087 | msg := &mockCommit{ |
| 1088 | message: "feat: add feature\nThis is the body", |
| 1089 | body: "This is the body", |
| 1090 | } |
| 1091 | _, ok := r.Validate(msg) |
| 1092 | if ok { |
| 1093 | t.Error("body without leading blank line should fail") |
| 1094 | } |
| 1095 | } |
| 1096 | |
| 1097 | func TestBodyLeadingBlank_EmptyBody_Pass(t *testing.T) { |
| 1098 | r := &rule.BodyLeadingBlankRule{} |