Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lexer_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,13 @@ func descriptionDelimiterState(l *lexer) stateFunc {
l.Emit(breakingChangeToken)
}

l.Take(": ")
l.Next()

if l.Current() != ": " {
if l.Current() != ":" || l.Peek() != ' ' {
l.Error(errDescMissingDelimiter)
return nil
}
l.Next()

l.Emit(descDelimiterToken)

Expand Down
20 changes: 20 additions & 0 deletions parser_header_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,24 @@ func TestParseHeaderValid(t *testing.T) {
"feat: description with body 1, \n\n2, 3 and 4?",
"feat1234(@scope/scope1,scope2): description, \n\n body 1 2, 3 and 4?",
"1245#feat1234(@scope/scope1,scope2): description, \n\n body 1 2, 3 and 4?",
"feat: description with colon at the end: mid:dle and :start of words",
"feat: description with gitmoji at the end :hammer:",
"feat: description with gitmoji in :hammer: the middle",
"feat: :hammer: description with gitmoji at the start",
"feat(scope): description with colon at the end: mid:dle and :start of words",
"feat(scope): description with gitmoji at the end :hammer:",
"feat(scope): description with gitmoji in :hammer: the middle",
"feat(scope): :hammer: description with gitmoji at the start",
"feat!: description with colon at the end: mid:dle and :start of words",
"feat!: description with gitmoji at the end :hammer:",
"feat!: description with gitmoji in :hammer: the middle",
"feat!: :hammer: description with gitmoji at the start",
"feat(scope)!: description with colon at the end: mid:dle and :start of words",
"feat(scope)!: description with gitmoji at the end :hammer:",
"feat(scope)!: description with gitmoji in :hammer: the middle",
"feat(scope)!: :hammer: description with gitmoji at the start",
`feat: : : A description`,
`feat: :: A description ::`,
}

p := New()
Expand Down Expand Up @@ -52,6 +70,8 @@ func TestParseHeaderInvalid(t *testing.T) {
`feat((`,
`feat():`,
`feat):`,
`feat:: A description`,
`feat:::: A description`,
}

p := New()
Expand Down