2024-05-17 18:30:33 +08:00
|
|
|
// Copyright 2021 GoEdge goedge.cdn@gmail.com. All rights reserved.
|
2021-12-08 15:17:45 +08:00
|
|
|
|
2023-07-26 18:45:17 +08:00
|
|
|
package goman_test
|
2021-12-08 15:17:45 +08:00
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"testing"
|
|
|
|
|
"time"
|
2024-07-27 15:42:50 +08:00
|
|
|
|
|
|
|
|
"github.com/TeaOSLab/EdgeNode/internal/utils/goman"
|
2021-12-08 15:17:45 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func TestNew(t *testing.T) {
|
2023-07-26 18:45:17 +08:00
|
|
|
goman.New(func() {
|
2021-12-08 15:17:45 +08:00
|
|
|
t.Log("Hello")
|
|
|
|
|
|
2023-07-26 18:45:17 +08:00
|
|
|
t.Log(goman.List())
|
2021-12-08 15:17:45 +08:00
|
|
|
})
|
|
|
|
|
|
|
|
|
|
time.Sleep(1 * time.Second)
|
2023-07-26 18:45:17 +08:00
|
|
|
t.Log(goman.List())
|
2021-12-08 15:17:45 +08:00
|
|
|
|
|
|
|
|
time.Sleep(1 * time.Second)
|
|
|
|
|
}
|
2021-12-14 10:49:40 +08:00
|
|
|
|
|
|
|
|
func TestNewWithArgs(t *testing.T) {
|
2023-07-26 18:45:17 +08:00
|
|
|
goman.NewWithArgs(func(args ...interface{}) {
|
2021-12-14 10:49:40 +08:00
|
|
|
t.Log(args[0], args[1])
|
|
|
|
|
}, 1, 2)
|
|
|
|
|
time.Sleep(1 * time.Second)
|
|
|
|
|
}
|