Skip to content

Commit

Permalink
更新依赖
Browse files Browse the repository at this point in the history
  • Loading branch information
guonaihong committed Sep 28, 2024
1 parent a61a83d commit 8810967
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 32 deletions.
17 changes: 12 additions & 5 deletions cronex_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"time"

"github.com/antlabs/timer"
"github.com/stretchr/testify/assert"
)

func Test_Cronex(t *testing.T) {
Expand All @@ -29,7 +28,10 @@ func Test_Cronex(t *testing.T) {

durationChan <- time.Since(now)
})
assert.NoError(t, err)
if err != nil {
t.Logf("err(%v)", err)
return
}
}

// 3s之后关闭
Expand Down Expand Up @@ -58,16 +60,19 @@ func Test_Cronex(t *testing.T) {
count++
}

assert.NotEqual(t, count, 1, fmt.Sprintf("callback没有调用"))
if count != 1 {
t.Logf("count(%d), count != 1, callback 没有调用", count)
return
}
}

// 测试下Next函数的时间可正确
func Test_Cronex_ParseNext(t *testing.T) {

var schedule timer.Next
schedule, err := standardParser.Parse("* * * * * *")
assert.NoError(t, err)
if err != nil {
t.Logf("err(%v)", err)
return
}

Expand Down Expand Up @@ -101,5 +106,7 @@ func Test_Multiple(t *testing.T) {

time.Sleep(time.Duration(1.1 * float64(time.Second)))
cron.Stop()
assert.Equal(t, max, count)
if count != max {
t.Errorf("expected %d, got %d", max, count)
}
}
12 changes: 2 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@ module github.com/antlabs/cronex

go 1.19

require (
github.com/antlabs/timer v0.0.11
github.com/stretchr/testify v1.6.1
)
require github.com/antlabs/timer v0.1.4

require (
github.com/antlabs/stl v0.0.1 // indirect
github.com/davecgh/go-spew v1.1.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
gopkg.in/yaml.v3 v3.0.0 // indirect
)
require github.com/antlabs/stl v0.0.2 // indirect
21 changes: 4 additions & 17 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,17 +1,4 @@
github.com/antlabs/stl v0.0.1 h1:TRD3csCrjREeLhLoQ/supaoCvFhNLBTNIwuRGrDIs6Q=
github.com/antlabs/stl v0.0.1/go.mod h1:wvVwP1loadLG3cRjxUxK8RL4Co5xujGaZlhbztmUEqQ=
github.com/antlabs/timer v0.0.11 h1:z75oGFLeTqJHMOcWzUPBKsBbQAz4Ske3AfqJ7bsdcwU=
github.com/antlabs/timer v0.0.11/go.mod h1:JNV8J3yGvMKhCavGXgj9HXrVZkfdQyKCcqXBT8RdyuU=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/go-playground/assert.v1 v1.2.1 h1:xoYuJVE7KT85PYWrN730RguIQO0ePzVRfFMXadIrXTM=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0 h1:hjy8E9ON/egN1tAYqKb61G10WtihqetD4sz2H+8nIeA=
gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
github.com/antlabs/stl v0.0.2 h1:sna1AXR5yIkNE9lWhCcKbheFJSVfCa3vugnGyakI79s=
github.com/antlabs/stl v0.0.2/go.mod h1:kKrO4xrn9cfS1mJVo+/BqePZjAYMXqD0amGF2Ouq7ac=
github.com/antlabs/timer v0.1.4 h1:MHdE00MDnNfhJCmqSOdLXs35uGNwfkMwfbynxrGmQ1c=
github.com/antlabs/timer v0.1.4/go.mod h1:mpw4zlD5KVjstEyUDp43DGLWsY076Mdo4bS78NTseRE=

0 comments on commit 8810967

Please sign in to comment.