(t *testing.T)
| 113 | } |
| 114 | |
| 115 | func Test_ACPAgentIO_WriteAndReadScreen(t *testing.T) { |
| 116 | collector := newChunkCollector() |
| 117 | agent := &testAgent{ |
| 118 | onPrompt: func(ctx context.Context, conn *acp.AgentSideConnection, p acp.PromptRequest) (acp.PromptResponse, error) { |
| 119 | _ = conn.SessionUpdate(ctx, acp.SessionNotification{ |
| 120 | SessionId: p.SessionId, |
| 121 | Update: acp.UpdateAgentMessageText("Hello from agent!"), |
| 122 | }) |
| 123 | return acp.PromptResponse{StopReason: acp.StopReasonEndTurn}, nil |
| 124 | }, |
| 125 | } |
| 126 | agentIO := newTestPair(t, agent) |
| 127 | agentIO.SetOnChunk(collector.callback) |
| 128 | |
| 129 | n, err := agentIO.Write([]byte("test prompt")) |
| 130 | require.NoError(t, err) |
| 131 | assert.Equal(t, len("test prompt"), n) |
| 132 | |
| 133 | // SessionUpdate notifications are async — wait for the chunk to arrive. |
| 134 | collector.waitForN(t, 1) |
| 135 | assert.Equal(t, "Hello from agent!", agentIO.ReadScreen()) |
| 136 | } |
| 137 | |
| 138 | func Test_ACPAgentIO_StreamingChunks(t *testing.T) { |
| 139 | collector := newChunkCollector() |
nothing calls this directly
no test coverage detected