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

Function BenchmarkSyntaxAdapter

commit/parser_test.go:127–150  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

125var parsedNotes []commit.Note
126
127func BenchmarkSyntaxAdapter(b *testing.B) {
128 p := commit.NewParser()
129 for _, tt := range []struct {
130 name, input string
131 notes bool
132 }{
133 {"header", "feat: expose records", false},
134 {"footers", "feat: expose records\n\nRefs #9\nTrace: #91", false},
135 {"footers_with_notes", "feat: expose records\n\nRefs #9\nTrace: #91", true},
136 } {
137 b.Run(tt.name, func(b *testing.B) {
138 b.ReportAllocs()
139 for i := 0; i < b.N; i++ {
140 parsed, parseErr = p.Parse(tt.input)
141 if tt.notes && parseErr == nil {
142 parsedNotes = parsed.Notes()
143 }
144 }
145 if parseErr != nil {
146 b.Fatal(parseErr)
147 }
148 })
149 }
150}

Callers

nothing calls this directly

Calls 3

ParseMethod · 0.95
NewParserFunction · 0.92
NotesMethod · 0.65

Tested by

no test coverage detected