TestTruncateSnapsToRuneBoundary: Truncate's byte-offset cut must not slice multi-byte runes mid-sequence: output stays valid UTF-8.
(t *testing.T)
| 80 | } |
| 81 | if Tokens(out) > ToolTruncHead+ToolTruncTail+200 { |
| 82 | t.Fatalf("truncated output too large: %d tokens", Tokens(out)) |
| 83 | } |
| 84 | if !strings.HasPrefix(out, in[:100]) { |
| 85 | t.Fatal("expected head preserved") |
| 86 | } |
| 87 | if !strings.HasSuffix(out, in[len(in)-100:]) { |
| 88 | t.Fatal("expected tail preserved") |
| 89 | } |
| 90 | // Tail bias: errors sit at the end of long output, so the kept tail must be |
| 91 | // larger than the kept head (the spill file covers the dropped middle). |
| 92 | if ToolTruncTail <= ToolTruncHead { |
| 93 | t.Fatalf("truncation must keep more tail than head, got head=%d tail=%d", ToolTruncHead, ToolTruncTail) |
| 94 | } |
nothing calls this directly
no test coverage detected