You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
telebot/poller_test.go

26 lines
404 B
Go

package telebot
type testPoller struct {
updates chan Update
done chan struct{}
}
func newTestPoller() *testPoller {
return &testPoller{
updates: make(chan Update, 1),
done: make(chan struct{}, 1),
}
}
func (p *testPoller) Poll(b *Bot, updates chan Update, stop chan struct{}) {
for {
select {
case upd := <-p.updates:
updates <- upd
case <-stop:
return
default:
}
}
}