github.com/TeaOSLab/EdgeNode@v1.3.8/internal/utils/percpu/chan_test.go (about)

     1  // Copyright 2024 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
     2  
     3  package percpu_test
     4  
     5  import (
     6  	"github.com/TeaOSLab/EdgeNode/internal/utils/percpu"
     7  	"github.com/TeaOSLab/EdgeNode/internal/zero"
     8  	"testing"
     9  )
    10  
    11  func TestChan_C(t *testing.T) {
    12  	var c = percpu.NewChan[zero.Zero](10)
    13  	c.C() <- zero.Zero{}
    14  
    15  	t.Log(<-c.C())
    16  
    17  	select {
    18  	case <-c.C():
    19  		t.Fatal("should not return from here")
    20  	default:
    21  		t.Log("ok")
    22  	}
    23  }