TestPasteIntoChipInteriorKeepsBothPastes: a paste while the cursor sits inside an existing chip's label must not splice the new label into the old one. insertChip snaps out of the chip first; without that, reconcile loses a chip's content and the LLM payload is silently wrong.
(t *testing.T)
| 489 | // insertChip snaps out of the chip first; without that, reconcile loses a |
| 490 | // chip's content and the LLM payload is silently wrong. |
| 491 | func TestPasteIntoChipInteriorKeepsBothPastes(t *testing.T) { |
| 492 | p := newChippablePrompt() |
| 493 | n := pasteChipMinLines + 4 |
| 494 | a := strings.Repeat("AAAA\n", n-1) + "Aend" |
| 495 | b := strings.Repeat("BBBB\n", n-1) + "Bend" |
| 496 | p, _ = p.Update(pasteKey(a)) |
| 497 | if len(p.spans) != 1 { |
| 498 | t.Fatalf("setup: expected 1 chip, got %d", len(p.spans)) |
| 499 | } |
| 500 | p.setCursorRuneOffset(p.spans[0].start + 3) // strictly inside chip A's label |
| 501 | p, _ = p.Update(pasteKey(b)) |
| 502 | if len(p.spans) != 2 { |
| 503 | t.Fatalf("expected 2 intact chips after interior paste, got %d", len(p.spans)) |
| 504 | } |
| 505 | v := p.Value() |
| 506 | if !strings.Contains(v, "Aend") { |
| 507 | t.Fatalf("paste A content lost: %q", v) |
| 508 | } |
| 509 | if !strings.Contains(v, "Bend") { |
| 510 | t.Fatalf("paste B content lost/cross-mapped: %q", v) |
| 511 | } |
| 512 | } |
| 513 | |
| 514 | // TestTypingIntoChipInteriorKeepsContent: typing a rune while the cursor sits |
| 515 | // inside a chip label, when two chips share an identical label, must not split |
nothing calls this directly
no test coverage detected