nsf / termbox-go

Pure Go termbox implementation
http://godoc.org/github.com/nsf/termbox-go
MIT License
4.67k stars 373 forks source link

FireEvent method in API #203

Open ivch opened 5 years ago

ivch commented 5 years ago

I have some experience using this library. Sometimes it would be nice to have an ability to fire keyboard event in tests. For example in such case:

func Listen() {
  for {
    e := termbox.PollEvent()

    switch e.Type {
    case termbox.EventKey:
      //do smth
    case termbox.EventInterrupt:
      //do smth
    case termbox.EventError:
      //do smth
    }
  }
}