(msg string)
| 99 | type customParser struct{} |
| 100 | |
| 101 | func (p *customParser) Parse(msg string) (commit.Commit, error) { |
| 102 | if msg == "bad" { |
| 103 | return nil, errors.New("custom parse failure") |
| 104 | } |
| 105 | header, rest, _ := strings.Cut(msg, "\n\n") |
| 106 | typ, desc, _ := strings.Cut(header, ": ") |
| 107 | c := &mockCommit{ |
| 108 | message: msg, |
| 109 | header: header, |
| 110 | body: rest, |
| 111 | typ: typ, |
| 112 | description: desc, |
| 113 | } |
| 114 | if strings.HasPrefix(msg, "warn:") { |
| 115 | return c, errors.New("recoverable custom error") |
| 116 | } |
| 117 | return c, nil |
| 118 | } |
| 119 | |
| 120 | func TestCustomParserIntegration(t *testing.T) { |
| 121 | conf := config.NewDefault() |
nothing calls this directly
no outgoing calls
no test coverage detected