============================================================ Leading-blank rules ============================================================
(t *testing.T)
| 1064 | // ============================================================ |
| 1065 | |
| 1066 | func TestBodyLeadingBlank_WithBlank_Pass(t *testing.T) { |
| 1067 | r := &rule.BodyLeadingBlankRule{} |
| 1068 | if err := r.Apply(lint.RuleSetting{}); err != nil { |
| 1069 | t.Fatal(err) |
| 1070 | } |
| 1071 | // message: header + blank line + body |
| 1072 | msg := &mockCommit{ |
| 1073 | message: "feat: add feature\n\nThis is the body", |
| 1074 | body: "This is the body", |
| 1075 | } |
| 1076 | _, ok := r.Validate(msg) |
| 1077 | if !ok { |
| 1078 | t.Error("body with leading blank line should pass") |
| 1079 | } |
| 1080 | } |
| 1081 | |
| 1082 | func TestBodyLeadingBlank_WithoutBlank_Fail(t *testing.T) { |
| 1083 | r := &rule.BodyLeadingBlankRule{} |