logtest_test.go 386 B

12345678910111213141516171819202122
  1. package logtest
  2. import (
  3. "testing"
  4. "github.com/stretchr/testify/assert"
  5. "github.com/zeromicro/go-zero/core/logx"
  6. )
  7. func TestCollector(t *testing.T) {
  8. const input = "hello"
  9. c := NewCollector(t)
  10. logx.Info(input)
  11. assert.Equal(t, input, c.Content())
  12. assert.Contains(t, c.String(), input)
  13. }
  14. func TestDiscard(t *testing.T) {
  15. const input = "hello"
  16. Discard(t)
  17. logx.Info(input)
  18. }