lesswriter_test.go 323 B

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