File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -553,6 +553,20 @@ func BenchmarkDo(b *testing.B) {
553553 }
554554}
555555
556+ func BenchmarkDoWithData (b * testing.B ) {
557+ testError := errors .New ("test error" )
558+
559+ for i := 0 ; i < b .N ; i ++ {
560+ _ , _ = DoWithData (
561+ func () (int , error ) {
562+ return 0 , testError
563+ },
564+ Attempts (10 ),
565+ Delay (0 ),
566+ )
567+ }
568+ }
569+
556570func BenchmarkDoNoErrors (b * testing.B ) {
557571 for i := 0 ; i < b .N ; i ++ {
558572 _ = Do (
@@ -565,6 +579,18 @@ func BenchmarkDoNoErrors(b *testing.B) {
565579 }
566580}
567581
582+ func BenchmarkDoWithDataNoErrors (b * testing.B ) {
583+ for i := 0 ; i < b .N ; i ++ {
584+ _ , _ = DoWithData (
585+ func () (int , error ) {
586+ return 0 , nil
587+ },
588+ Attempts (10 ),
589+ Delay (0 ),
590+ )
591+ }
592+ }
593+
568594func TestIsRecoverable (t * testing.T ) {
569595 err := errors .New ("err" )
570596 assert .True (t , IsRecoverable (err ))
You can’t perform that action at this time.
0 commit comments