Skip to content

Commit

Permalink
feat: add custom tag/expr
Browse files Browse the repository at this point in the history
Signed-off-by: rfyiamcool <[email protected]>
  • Loading branch information
rfyiamcool authored and adhocore committed Mar 10, 2024
1 parent 15c9cff commit 3bc3b1d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 0 additions & 2 deletions gronx.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package gronx

import (
"errors"
"fmt"
"regexp"
"strings"
"time"
Expand Down Expand Up @@ -43,7 +42,6 @@ func AddTag(tag, expr string) error {
expr = strings.Join(segs, " ")

expressions[tag] = expr
fmt.Println(expr)
return nil
}

Expand Down
9 changes: 9 additions & 0 deletions gronx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,15 @@ func TestAddTag(t *testing.T) {
if err != nil {
t.Error("expected nil, got err")
}

expr, ok := expressions["@2s"]
if !ok {
t.Error("expected true, got false")
}

if expr != "*/2 * * * * *" {
t.Error("expected */2 * * * * *")
}
})

t.Run("add conflict tag", func(t *testing.T) {
Expand Down

0 comments on commit 3bc3b1d

Please sign in to comment.