Skip to content

Commit cb10257

Browse files
Updated PR review fixes
1 parent 641acb2 commit cb10257

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

04_numeronym/sirigithub/main.go

+3-4
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,10 @@ func numeronyms(vals ...string) []string {
1313
for i, val := range vals {
1414
r := []rune(val)
1515
runeLength := len(r)
16-
if runeLength < 4 {
17-
result[i] = val
18-
} else {
19-
result[i] = fmt.Sprintf("%c%d%c", r[0], runeLength-2, r[runeLength-1])
16+
if runeLength > 3 {
17+
val = fmt.Sprintf("%c%d%c", r[0], runeLength-2, r[runeLength-1])
2018
}
19+
result[i] = val
2120
}
2221
return result
2322
}

04_numeronym/sirigithub/main_test.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,10 @@ func TestNumeronyms(t *testing.T) {
3636
expected: []string{"a6$", "*3]"}},
3737
}
3838
for _, test := range tests {
39-
actual := numeronyms(test.input...)
40-
expected := test.expected
39+
test := test
4140
t.Run(test.description, func(t *testing.T) {
41+
actual := numeronyms(test.input...)
42+
expected := test.expected
4243
assert.Equal(t, actual, expected, "actual %v but expected %v", actual, expected)
4344
})
4445
}

0 commit comments

Comments
 (0)