mirror of
https://github.com/v2fly/v2ray-core.git
synced 2026-02-04 15:25:24 -05:00
remove dependency on assert lib
This commit is contained in:
@@ -4,15 +4,11 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
. "v2ray.com/core/common/task"
|
||||
. "v2ray.com/ext/assert"
|
||||
|
||||
"v2ray.com/core/common"
|
||||
. "v2ray.com/core/common/task"
|
||||
)
|
||||
|
||||
func TestPeriodicTaskStop(t *testing.T) {
|
||||
assert := With(t)
|
||||
|
||||
value := 0
|
||||
task := &Periodic{
|
||||
Interval: time.Second * 2,
|
||||
@@ -24,9 +20,13 @@ func TestPeriodicTaskStop(t *testing.T) {
|
||||
common.Must(task.Start())
|
||||
time.Sleep(time.Second * 5)
|
||||
common.Must(task.Close())
|
||||
assert(value, Equals, 3)
|
||||
if value != 3 {
|
||||
t.Fatal("expected 3, but got ", value)
|
||||
}
|
||||
time.Sleep(time.Second * 4)
|
||||
assert(value, Equals, 3)
|
||||
if value != 3 {
|
||||
t.Fatal("expected 3, but got ", value)
|
||||
}
|
||||
common.Must(task.Start())
|
||||
time.Sleep(time.Second * 3)
|
||||
if value != 5 {
|
||||
|
||||
Reference in New Issue
Block a user