remove livelock

This commit is contained in:
Niko Storni 2021-03-17 16:40:37 +01:00
parent cacd21f840
commit 55577201a4
2 changed files with 3 additions and 1 deletions

View file

@ -72,7 +72,7 @@ func getClaimNameFromTitle(title string, attempt int) string {
name := chunks[0] name := chunks[0]
if len(name) > maxLen { if len(name) > maxLen {
return truncateUnicode(name, maxLen) return truncateUnicode(name, maxLen) + suffix
} }
for _, chunk := range chunks[1:] { for _, chunk := range chunks[1:] {

View file

@ -21,4 +21,6 @@ func Test_getClaimNameFromTitle(t *testing.T) {
assert.Equal(t, "test", name) assert.Equal(t, "test", name)
name = getClaimNameFromTitle("『あなたはただの空の殻でした』", 0) name = getClaimNameFromTitle("『あなたはただの空の殻でした』", 0)
assert.Equal(t, "『あなたはただの空の殻でした』", name) assert.Equal(t, "『あなたはただの空の殻でした』", name)
name = getClaimNameFromTitle("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", 50)
assert.Equal(t, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-50", name)
} }