Skip to content

Commit 0a256ab

Browse files
committed
feat: strhlp coverage
1 parent 7ce965b commit 0a256ab

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

strhlp/strhlp.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ func Normalize(s string) string {
2121
),
2222
strings.ToLower(s),
2323
); err == nil {
24-
return r
24+
s = r
2525
}
2626

2727
return s

strhlp/strhlp_test.go

+20
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ func TestNormalize(t *testing.T) {
2121
})
2222
}
2323
}
24+
2425
func TestInSlice(t *testing.T) {
2526
tts := []struct {
2627
name string
@@ -279,3 +280,22 @@ func TestListForHumans(t *testing.T) {
279280
})
280281
}
281282
}
283+
284+
func TestIsSimilar(t *testing.T) {
285+
tts := [][]string{
286+
{"similar", "similar"},
287+
{"some long string", "Some Long STRING"},
288+
{"atencao", "Atenção"},
289+
{"it should've this kind of keep \"stuff\"",
290+
"It should've this kind of keep \"STUFF\""},
291+
}
292+
293+
for i := range tts {
294+
t.Run(tts[i][0], func(t *testing.T) {
295+
assert.True(t, strhlp.IsSimilar(tts[i][0])(tts[i][1]),
296+
"first should be similar to second")
297+
assert.True(t, strhlp.IsSimilar(tts[i][1])(tts[i][0]),
298+
"second should be similar to first")
299+
})
300+
}
301+
}

0 commit comments

Comments
 (0)