github.com/lingyao2333/mo-zero@v1.4.1/core/logx/lesswriter_test.go (about) 1 package logx 2 3 import ( 4 "strings" 5 "testing" 6 7 "github.com/stretchr/testify/assert" 8 ) 9 10 func TestLessWriter(t *testing.T) { 11 var builder strings.Builder 12 w := newLessWriter(&builder, 500) 13 for i := 0; i < 100; i++ { 14 _, err := w.Write([]byte("hello")) 15 assert.Nil(t, err) 16 } 17 18 assert.Equal(t, "hello", builder.String()) 19 }