mirror of
https://github.com/kubenetworks/kubevpn.git
synced 2025-12-24 11:51:13 +08:00
24 lines
281 B
Go
24 lines
281 B
Go
package util
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
func TestChanClose(t *testing.T) {
|
|
c := make(chan any)
|
|
close(c)
|
|
SafeWrite(c, nil)
|
|
|
|
c = make(chan any)
|
|
go func() {
|
|
time.AfterFunc(time.Second*3, func() {
|
|
close(c)
|
|
})
|
|
}()
|
|
for a := range c {
|
|
fmt.Printf("%v", a)
|
|
}
|
|
}
|