github.com/TeaOSLab/EdgeNode@v1.3.8/internal/goman/lib_test.go (about) 1 // Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved. 2 3 package goman_test 4 5 import ( 6 "github.com/TeaOSLab/EdgeNode/internal/goman" 7 "testing" 8 "time" 9 ) 10 11 func TestNew(t *testing.T) { 12 goman.New(func() { 13 t.Log("Hello") 14 15 t.Log(goman.List()) 16 }) 17 18 time.Sleep(1 * time.Second) 19 t.Log(goman.List()) 20 21 time.Sleep(1 * time.Second) 22 } 23 24 func TestNewWithArgs(t *testing.T) { 25 goman.NewWithArgs(func(args ...interface{}) { 26 t.Log(args[0], args[1]) 27 }, 1, 2) 28 time.Sleep(1 * time.Second) 29 }