@@ -570,6 +570,7 @@ func TestBlocking(t *testing.T) {
570570 )
571571
572572 added := make (chan struct {}, initialSize + 1 )
573+
573574 for i := 1 ; i <= initialSize + 1 ; i ++ {
574575 go func (i int ) {
575576 blockingQueue .OfferWait (i )
@@ -578,6 +579,7 @@ func TestBlocking(t *testing.T) {
578579 }
579580
580581 time .Sleep (time .Millisecond )
582+
581583 _ = blockingQueue .Clear ()
582584
583585 // one groutine block, and three are added
@@ -586,12 +588,15 @@ func TestBlocking(t *testing.T) {
586588 }
587589
588590 time .Sleep (time .Millisecond )
591+
589592 if blockingQueue .Size () != initialSize {
590593 t .Fatalf ("expected size to be %d, got %d" , initialSize , blockingQueue .Size ())
591594 }
592595
593596 _ = blockingQueue .GetWait ()
597+
594598 time .Sleep (time .Millisecond )
599+
595600 if blockingQueue .Size () != initialSize {
596601 t .Fatalf ("expected size to be %d, got %d" , initialSize , blockingQueue .Size ())
597602 }
@@ -617,6 +622,7 @@ func TestBlocking(t *testing.T) {
617622 }
618623
619624 retrievedElem := make (chan int , initialSize + 1 )
625+
620626 for i := 1 ; i <= initialSize + 1 ; i ++ {
621627 go func () {
622628 retrievedElem <- blockingQueue .GetWait ()
@@ -636,6 +642,7 @@ func TestBlocking(t *testing.T) {
636642 }
637643
638644 blockingQueue .OfferWait (4 )
645+
639646 if e := <- retrievedElem ; e != 4 {
640647 t .Fatalf ("expected elem to be %d, got %d" , 4 , e )
641648 }
0 commit comments