TestInlineStatusRuneBoundaryTruncate: truncating a long non-ASCII command at a fixed byte offset can split a multi-byte rune, leaving an orphan continuation byte the TUI prints as invalid UTF-8. The cut must snap back to a rune boundary, trading a couple chars off the byte budget for valid UTF-8.
(t *testing.T)
| 268 | // TestInlineStatusRuneBoundaryTruncate: truncating a long non-ASCII command at |
| 269 | // a fixed byte offset can split a multi-byte rune, leaving an orphan |
| 270 | // continuation byte the TUI prints as invalid UTF-8. The cut must snap back to |
| 271 | // a rune boundary, trading a couple chars off the byte budget for valid UTF-8. |
| 272 | func TestInlineStatusRuneBoundaryTruncate(t *testing.T) { |
| 273 | cmd := strings.Repeat("ä", 100) + " end" // 200+ bytes of 2-byte runes |
| 274 | s := InlineStatus(chmctx.ToolCall{ |
| 275 | Name: "bash", |
| 276 | Arguments: map[string]any{"cmd": cmd}, |
| 277 | }) |
| 278 | if !utf8.ValidString(s) { |
| 279 | t.Fatalf("InlineStatus produced invalid UTF-8 (cut mid-rune): %q", s) |
| 280 | } |
| 281 | } |
| 282 |
nothing calls this directly
no test coverage detected