diff --git a/basic_test.go b/basic_test.go index aaad88a..49cc4d7 100644 --- a/basic_test.go +++ b/basic_test.go @@ -318,6 +318,11 @@ func TestCloseBlocking(t *testing.T) { sub.Close() // cancel sub } +func panicOnTimeout(d time.Duration) { + <-time.After(d) + panic("timeout reached") +} + func TestSubFailFully(t *testing.T) { bus := NewBus() em, err := bus.Emitter(new(EventB)) @@ -330,6 +335,8 @@ func TestSubFailFully(t *testing.T) { t.Fatal(err) } + go panicOnTimeout(5 * time.Second) + em.Emit(EventB(159)) // will hang if sub doesn't fail properly }