Skip to content

Commit bc1d38d

Browse files
committed
Use CamelCase for test naming. Underscores are not linted by golint for test files but maybe should be?
1 parent c51312f commit bc1d38d

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

internal/models/models.go

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,21 +126,18 @@ func (f *Function) FullName() string {
126126
return strings.Title(r) + strings.Title(f.Name)
127127
}
128128

129-
func (f *Function) TestName() string {
129+
func (f *Function) Tes_tName() string {
130130
if strings.HasPrefix(f.Name, "Test") {
131131
return f.Name
132132
}
133133
if f.Receiver != nil {
134134
receiverType := f.Receiver.Type.Value
135135
if unicode.IsLower([]rune(receiverType)[0]) {
136-
receiverType = "_" + receiverType
136+
receiverType = strings.Title(receiverType)
137137
}
138-
return "Test" + receiverType + "_" + f.Name
138+
return "Test" + receiverType + strings.Title(f.Name)
139139
}
140-
if unicode.IsLower([]rune(f.Name)[0]) {
141-
return "Test_" + f.Name
142-
}
143-
return "Test" + f.Name
140+
return "Test" + strings.Title(f.Name)
144141
}
145142

146143
func (f *Function) IsNaked() bool {

0 commit comments

Comments
 (0)