Skip to content

Commit

Permalink
fix: prefix with upper case letters
Browse files Browse the repository at this point in the history
Signed-off-by: Fernandez Ludovic <ldez@users.noreply.github.com>
  • Loading branch information
ldez committed Jul 18, 2022
1 parent 6f5cb16 commit 7a66b95
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/section/parser.go
Expand Up @@ -25,10 +25,10 @@ func Parse(data []string) (SectionList, error) {
list = append(list, Standard{})
} else if s == "newline" {
list = append(list, NewLine{})
} else if strings.HasPrefix(s, "prefix(") && len(s) > 8 {
list = append(list, Custom{s[7 : len(s)-1]})
} else if strings.HasPrefix(s, "commentline(") && len(s) > 13 {
list = append(list, Custom{s[12 : len(s)-1]})
} else if strings.HasPrefix(s, "prefix(") && len(d) > 8 {
list = append(list, Custom{d[7 : len(d)-1]})
} else if strings.HasPrefix(s, "commentline(") && len(d) > 13 {
list = append(list, Custom{d[12 : len(d)-1]})
} else {
errString += fmt.Sprintf(" %s", s)
}
Expand Down
5 changes: 5 additions & 0 deletions pkg/section/parser_test.go
Expand Up @@ -25,6 +25,11 @@ func TestParse(t *testing.T) {
expectedSection: SectionList{Custom{"go"}},
expectedError: nil,
},
{
input: []string{"prefix(go-UPPER-case)"},
expectedSection: SectionList{Custom{"go-UPPER-case"}},
expectedError: nil,
},
{
input: []string{"prefix("},
expectedSection: nil,
Expand Down

0 comments on commit 7a66b95

Please sign in to comment.