MCPcopy Create free account
hub / github.com/codehamr/codehamr / TestInlineStatusRuneBoundaryTruncate

Function TestInlineStatusRuneBoundaryTruncate

internal/tools/bash_test.go:270–279  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
272func 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

Callers

nothing calls this directly

Calls 1

InlineStatusFunction · 0.85

Tested by

no test coverage detected