1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-08 14:42:27 +08:00

refactor: rewrite all unit test functions with assert

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

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() {