2022-08-31 12:46:19 +00:00
|
|
|
package cron
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestCron(t *testing.T) {
|
|
|
|
c := NewCron(time.Second)
|
|
|
|
c.Do(func() {
|
|
|
|
t.Logf("cron log")
|
|
|
|
})
|
2022-09-14 07:13:02 +00:00
|
|
|
time.Sleep(time.Second * 3)
|
|
|
|
c.Stop()
|
2022-08-31 12:46:19 +00:00
|
|
|
c.Stop()
|
|
|
|
}
|