1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-08-06 17:41:00 +00:00

refactor(template): remove unused functions and reduce the complexity of truncate function

- Remove unused functions like hasKey, domain, hasPrefix and contains.
- Lower the complexity of truncate from O(n) to O(1).
This commit is contained in:
Julien Voisin 2025-07-18 05:53:41 +02:00 committed by GitHub
parent d80fb242db
commit 1825320369
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 29 deletions

View file

@ -43,18 +43,6 @@ func TestDictWithInvalidMap(t *testing.T) {
}
}
func TestHasKey(t *testing.T) {
input := map[string]string{"k": "v"}
if !hasKey(input, "k") {
t.Fatal(`This key exists in the map and should returns true`)
}
if hasKey(input, "missing") {
t.Fatal(`This key doesn't exists in the given map and should returns false`)
}
}
func TestTruncateWithShortTexts(t *testing.T) {
scenarios := []string{"Short text", "Короткий текст"}