mockAgentIO implements acpio.ChunkableAgentIO for testing. It provides a channel-based synchronization mechanism to test ACPConversation without relying on time.Sleep.
| 18 | // It provides a channel-based synchronization mechanism to test ACPConversation |
| 19 | // without relying on time.Sleep. |
| 20 | type mockAgentIO struct { |
| 21 | mu sync.Mutex |
| 22 | written []byte |
| 23 | screenContent string |
| 24 | onChunkFn func(chunk string) |
| 25 | |
| 26 | // Control behavior |
| 27 | writeErr error |
| 28 | // writeBlock is a channel that, if non-nil, will cause Write to block until closed. |
| 29 | // This allows tests to control when the write completes. |
| 30 | writeBlock chan struct{} |
| 31 | // writeStarted is closed when Write begins (before blocking on writeBlock). |
| 32 | // This allows tests to synchronize on the write starting. |
| 33 | writeStarted chan struct{} |
| 34 | } |
| 35 | |
| 36 | // mockEmitter implements screentracker.Emitter for testing. |
| 37 | type mockEmitter struct { |
nothing calls this directly
no outgoing calls
no test coverage detected