Skip to content

Commit

Permalink
Updated PR review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sirishavadrevu committed Jul 12, 2019
1 parent 641acb2 commit cb10257
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
7 changes: 3 additions & 4 deletions 04_numeronym/sirigithub/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@ func numeronyms(vals ...string) []string {
for i, val := range vals {
r := []rune(val)
runeLength := len(r)
if runeLength < 4 {
result[i] = val
} else {
result[i] = fmt.Sprintf("%c%d%c", r[0], runeLength-2, r[runeLength-1])
if runeLength > 3 {
val = fmt.Sprintf("%c%d%c", r[0], runeLength-2, r[runeLength-1])
}
result[i] = val
}
return result
}
Expand Down
5 changes: 3 additions & 2 deletions 04_numeronym/sirigithub/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ func TestNumeronyms(t *testing.T) {
expected: []string{"a6$", "*3]"}},
}
for _, test := range tests {
actual := numeronyms(test.input...)
expected := test.expected
test := test
t.Run(test.description, func(t *testing.T) {
actual := numeronyms(test.input...)
expected := test.expected
assert.Equal(t, actual, expected, "actual %v but expected %v", actual, expected)
})
}
Expand Down

0 comments on commit cb10257

Please sign in to comment.