Skip to content

Commit 4a4ad85

Browse files
committed
Fix for negative step
1 parent 28b4284 commit 4a4ad85

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

gronx_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ func TestIsValid(t *testing.T) {
6060
if !gron.IsValid("* 00 * * *") {
6161
t.Errorf("expected true, got false")
6262
}
63+
if !gron.IsValid("0-0/-005 * * * *") {
64+
t.Errorf("expected true, got false")
65+
}
6366
})
6467

6568
t.Run("is not valid", func(t *testing.T) {

validator.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ func inStep(val int, s string, bounds []int) (bool, error) {
1414
if err != nil {
1515
return false, err
1616
}
17-
if step == 0 {
17+
if step <= 0 {
1818
return false, errors.New("step can't be 0")
1919
}
2020

0 commit comments

Comments
 (0)