Commit 454cbe54 authored by Jakub Sztandera's avatar Jakub Sztandera

Make the test fail in reasonable time

License: MIT
Signed-off-by: default avatarJakub Sztandera <kubuxu@protonmail.ch>
parent 3fd76c7e
......@@ -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
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment