Skip to content

Commit

Permalink
Fixed a bug with the Limit strategy
Browse files Browse the repository at this point in the history
  • Loading branch information
Rican7 committed Jun 30, 2016
1 parent 2f098aa commit 678601c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion strategy/strategy.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type Strategy func(attempt uint) bool
// make.
func Limit(attemptLimit uint) Strategy {
return func(attempt uint) bool {
return (attempt < attemptLimit)
return (attempt <= attemptLimit)
}
}

Expand Down
6 changes: 5 additions & 1 deletion strategy/strategy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ func TestLimit(t *testing.T) {
t.Error("strategy expected to return true")
}

if strategy(3) {
if !strategy(3) {
t.Error("strategy expected to return true")
}

if strategy(4) {
t.Error("strategy expected to return false")
}
}
Expand Down

0 comments on commit 678601c

Please sign in to comment.