MCPcopy Create free account
hub / github.com/conventionalcommit/commitlint / TestBodyMaxLineLen_Fail

Function TestBodyMaxLineLen_Fail

test/rule_test.go:157–169  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

155}
156
157func 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
171func TestBodyMaxLineLen_EmptyBody(t *testing.T) {
172 r := &rule.BodyMaxLineLenRule{}

Callers

nothing calls this directly

Calls 4

ApplyMethod · 0.95
ValidateMethod · 0.95
ErrorMethod · 0.80
InfosMethod · 0.80

Tested by

no test coverage detected