github.com/lingyao2333/mo-zero@v1.4.1/core/proc/goroutines_test.go (about)

     1  package proc
     2  
     3  import (
     4  	"strings"
     5  	"testing"
     6  
     7  	"github.com/lingyao2333/mo-zero/core/logx"
     8  	"github.com/stretchr/testify/assert"
     9  )
    10  
    11  func TestDumpGoroutines(t *testing.T) {
    12  	var buf strings.Builder
    13  	w := logx.NewWriter(&buf)
    14  	o := logx.Reset()
    15  	logx.SetWriter(w)
    16  	defer func() {
    17  		logx.Reset()
    18  		logx.SetWriter(o)
    19  	}()
    20  
    21  	dumpGoroutines()
    22  	assert.True(t, strings.Contains(buf.String(), ".dump"))
    23  }