refactor: rewrite all unit test functions with assert

This commit is contained in:
dudaodong committed 2022-01-09 15:48:29 +08:00
1 parent b0e17c7bc4
commit 1199c30ef3
2 files changed
+26 -28

No files matched your search

+8 -6
View File
@@ -2,26 +2,28 @@ package function
import (
"testing"
"github.com/duke-git/lancet/internal"
)
func TestWatcher(t *testing.T) {
assert := internal.NewAssert(t, "TestWatcher")
w := &Watcher{}
w.Start()
longRunningTask()
if !w.excuting {
t.FailNow()
}
assert.Equal(true, w.excuting)
w.Stop()
eapsedTime := w.GetElapsedTime().Milliseconds()
t.Log("Elapsed Time (milsecond)", eapsedTime)
if w.excuting {
t.FailNow()
}
assert.Equal(false, w.excuting)
w.Reset()
}
func longRunningTask() {