(t *testing.T)
| 16 | } |
| 17 | |
| 18 | func TestLoopUntil(t *testing.T) { |
| 19 | step := Loop(counter(), |
| 20 | Until(func(ctx context.Context, s State, iter int) (bool, error) { |
| 21 | n, _ := strconv.Atoi(s.String()) |
| 22 | return n >= 3, nil |
| 23 | }), |
| 24 | LoopMax(100), |
| 25 | ) |
| 26 | out, err := step(context.Background(), State{Data: []byte("0")}) |
| 27 | if err != nil { |
| 28 | t.Fatal(err) |
| 29 | } |
| 30 | if out.String() != "3" { |
| 31 | t.Fatalf("expected 3, got %q", out.String()) |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | func TestLoopMaxCapStops(t *testing.T) { |
| 36 | runs := 0 |
nothing calls this directly
no test coverage detected
searching dependent graphs…