The two tests confused a nil pointer panic with the panic from a double
call to yield.
Change-Id: I0040e60cf4b702a92825d308db1201a85f164009
Reviewed-on: https://go-review.googlesource.com/c/go/+/617917
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
}
func TestPullDoubleYield(t *testing.T) {
- _, stop := Pull(storeYield())
+ next, stop := Pull(storeYield())
+ next()
+ if yieldSlot == nil {
+ t.Fatal("yield failed")
+ }
defer func() {
if recover() != nil {
yieldSlot = nil
var yieldSlot func(int) bool
func TestPullDoubleYield2(t *testing.T) {
- _, stop := Pull2(storeYield2())
+ next, stop := Pull2(storeYield2())
+ next()
+ if yieldSlot2 == nil {
+ t.Fatal("yield failed")
+ }
defer func() {
if recover() != nil {
yieldSlot2 = nil