From 029c268af6ba7ecf98cb80a5e5c420775a639df7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E8=8C=B6=E6=B8=85=E6=AC=A2?= Date: Thu, 29 May 2025 18:49:07 +0800 Subject: [PATCH] update unit test --- core_test.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/core_test.go b/core_test.go index 3075317..dc73705 100644 --- a/core_test.go +++ b/core_test.go @@ -23,7 +23,7 @@ var tw *TimeWheel // // Date : 17:00 2023/8/11 func TestNewTimeWheel(t *testing.T) { - tw = NewTimeWheel(10, 10*time.Second) + tw = NewTimeWheel(10, time.Second) tw.AddTask(&Task{ Key: wrapper.StringFromRandom(32, "").Value(), Interval: 5 * time.Second, @@ -36,8 +36,7 @@ func TestNewTimeWheel(t *testing.T) { }, false) go tw.Start() time.Sleep(3 * time.Second) - for tw.IsRunning { - + for tw.isRunning { } } @@ -61,7 +60,7 @@ func (t testTask) Callback(result *Result) error { return nil } -func (t testTask) Execute(ctx context.Context, cfg *Config) (map[string]any, error) { +func (t testTask) Execute(ctx context.Context, cfg *Config) *Result { fmt.Println(wrapper.OwnTimeFromNow().ToString()) - return nil, nil + return nil }