(t *testing.T)
| 201 | } |
| 202 | |
| 203 | func TestRetry_ContextCanceledDuringFn(t *testing.T) { |
| 204 | t.Parallel() |
| 205 | |
| 206 | ctx, cancel := context.WithCancel(context.Background()) |
| 207 | |
| 208 | err := chatretry.Retry(ctx, func(_ context.Context) error { |
| 209 | cancel() |
| 210 | return xerrors.New("overloaded") |
| 211 | }, nil) |
| 212 | |
| 213 | if !errors.Is(err, context.Canceled) { |
| 214 | t.Fatalf("expected context.Canceled, got %v", err) |
| 215 | } |
| 216 | } |
| 217 | |
| 218 | func TestRetry_OnRetryCalledWithCorrectArgs(t *testing.T) { |
| 219 | t.Parallel() |