A possible FAQ question
davecb opened this issue · 0 comments
davecb commented
I have a program that communicated between threads via a channel.
To test an error condition in the receiver, I wrote
Convey("Passing bad operations to send should panic worker", func(c C) {
// the panic happens in worker(), not send,
c.So(func() { r.send(-1, Err, 1) }, ShouldPanic)
})
r.send sends an illegal -1, the worker thread duly panics, and send returns without error, rather than reporting that a different thread panicked.
How do I construct a test that detects a panic in another thread? Can I?