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:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user