TestQueueRefusesSlashMix: a slash command never newline-joins with a queued prompt, in either order. Joined slash-first, the whole slot would fire as ONE slash command whose Fields-split swallows the prose as bogus args (a queued clear plus a follow-up instruction wipes the conversation AND silently
(t *testing.T)
| 85 | // the instruction); joined prose-first, the slash line ships to the LLM as |
| 86 | // prose. The refused draft must stay in the textarea, nothing lost. |
| 87 | func TestQueueRefusesSlashMix(t *testing.T) { |
| 88 | m := newTestModel(t, func(http.ResponseWriter, *http.Request) {}) |
| 89 | m.phase = phaseThinking |
| 90 | m.ta.SetValue("/clear") |
| 91 | o1, _ := m.Update(tea.KeyMsg{Type: tea.KeyEnter}) |
| 92 | m1 := o1.(Model) |
| 93 | if m1.queued == nil || m1.queued.send != "/clear" { |
| 94 | t.Fatalf("precondition: a slash prompt queues alone, got %+v", m1.queued) |
| 95 | } |
| 96 | |
| 97 | m1.ta.SetValue("run the tests") |
| 98 | o2, _ := m1.Update(tea.KeyMsg{Type: tea.KeyEnter}) |
| 99 | m2 := o2.(Model) |
| 100 | if m2.queued == nil || m2.queued.send != "/clear" { |
| 101 | t.Fatalf("append onto a queued slash command must be refused, got %+v", m2.queued) |
| 102 | } |
| 103 | if got := m2.ta.Value(); got != "run the tests" { |
| 104 | t.Fatalf("the refused draft must stay in the textarea, got %q", got) |
| 105 | } |
| 106 | |
| 107 | // Reverse order: prose queued first, slash appended. |
| 108 | mr := newTestModel(t, func(http.ResponseWriter, *http.Request) {}) |
| 109 | mr.phase = phaseThinking |
| 110 | mr.ta.SetValue("run the tests") |
| 111 | o3, _ := mr.Update(tea.KeyMsg{Type: tea.KeyEnter}) |
| 112 | m3 := o3.(Model) |
| 113 | m3.ta.SetValue("/clear") |
| 114 | o4, _ := m3.Update(tea.KeyMsg{Type: tea.KeyEnter}) |
| 115 | m4 := o4.(Model) |
| 116 | if m4.queued == nil || m4.queued.send != "run the tests" { |
| 117 | t.Fatalf("a slash append onto a queued prompt must be refused, got %+v", m4.queued) |
| 118 | } |
| 119 | if got := m4.ta.Value(); got != "/clear" { |
| 120 | t.Fatalf("the refused slash draft must stay in the textarea, got %q", got) |
| 121 | } |
| 122 | } |
| 123 | |
| 124 | // TestQueueAutoSubmitsAfterTurn drives a full turn with a prompt queued mid-flight |
| 125 | // and asserts the queued prompt auto-fires a second request when the turn ends, |
nothing calls this directly
no test coverage detected