1
0
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:
Darien Raymond
2019-01-31 20:57:01 +01:00
parent 25f0546228
commit c9958681f7
7 changed files with 81 additions and 53 deletions

View File

@@ -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 {