cron_test.go 455 B

1234567891011121314151617181920212223242526
  1. package mhayaCron
  2. import (
  3. "testing"
  4. "time"
  5. ctime "github.com/mhaya/extend/time"
  6. clog "github.com/mhaya/logger"
  7. )
  8. func TestAddEveryDayFunc(t *testing.T) {
  9. AddEveryDayFunc(func() {
  10. clog.Info(ctime.Now().ToDateTimeFormat())
  11. }, 17, 32, 5)
  12. AddEveryHourFunc(func() {
  13. clog.Info(ctime.Now().ToDateTimeFormat())
  14. panic("print panic~~~")
  15. }, 5, 5)
  16. AddDurationFunc(func() {
  17. clog.Info(ctime.Now().ToDateTimeFormat())
  18. }, 1*time.Minute)
  19. Run()
  20. }