(t *testing.T)
| 180 | } |
| 181 | |
| 182 | func TestCutLongTitle(t *testing.T) { |
| 183 | // Short title, no cutting needed |
| 184 | short := "hello" |
| 185 | assert.Equal(t, short, cutLongTitle(short)) |
| 186 | |
| 187 | // Exactly max bytes, no cutting needed |
| 188 | exact150 := strings.Repeat("a", 150) |
| 189 | assert.Len(t, cutLongTitle(exact150), 150) |
| 190 | |
| 191 | // Just over max bytes, should be cut |
| 192 | exact151 := strings.Repeat("a", 151) |
| 193 | assert.Len(t, cutLongTitle(exact151), 150) |
| 194 | |
| 195 | // Multi-byte rune at boundary gets removed properly |
| 196 | asciiPart := strings.Repeat("a", 149) // 149 bytes |
| 197 | multiByteChar := "中" // 3 bytes - will span bytes 149-151 |
| 198 | title := asciiPart + multiByteChar // 152 bytes total |
| 199 | |
| 200 | assert.Equal(t, asciiPart, cutLongTitle(title)) |
| 201 | } |
| 202 | |
| 203 | func TestFetchMatchedExcerpt(t *testing.T) { |
| 204 | var ( |
nothing calls this directly
no test coverage detected