assert.Equal(t, Error{syscall.SIGUSR2}, ctx.Err())
}
-func TestPrecompleted(t *testing.T) {
+func TestPrecanceled(t *testing.T) {
parent, cancel := context.WithCancel(context.Background())
cancel()
<-parent.Done()
case _, ok := <-ctx.Done():
assert.False(t, ok, "Done() should be closed")
default:
- assert.False(t, true, "context should be complete")
+ assert.False(t, true, "Done() should be closed")
}
assert.Equal(t, context.Canceled, ctx.Err())
}
}
}
-func BenchmarkPrecompleted(b *testing.B) {
+func BenchmarkPrecanceled(b *testing.B) {
parent, cancel := context.WithCancel(context.Background())
cancel()
<-parent.Done()