newTestSession creates a session with an event channel and starts the consumer goroutine. Returns a cleanup function that closes the channel (stopping the consumer).
()
| 20 | // newTestSession creates a session with an event channel and starts the consumer goroutine. |
| 21 | // Returns a cleanup function that closes the channel (stopping the consumer). |
| 22 | func newTestSession() (*Session, func()) { |
| 23 | s := &Session{ |
| 24 | handlers: make([]sessionHandler, 0), |
| 25 | commandHandlers: make(map[string]CommandHandler), |
| 26 | eventCh: make(chan SessionEvent, 128), |
| 27 | } |
| 28 | go s.processEvents() |
| 29 | return s, func() { close(s.eventCh) } |
| 30 | } |
| 31 | |
| 32 | func newTestEvent() SessionEvent { |
| 33 | return SessionEvent{Data: &SessionIdleData{}} |
no test coverage detected
searching dependent graphs…