mirror of
https://github.com/zeromicro/go-zero.git
synced 2026-05-07 15:10:01 +08:00
23 lines
386 B
Go
23 lines
386 B
Go
|
|
package logtest
|
||
|
|
|
||
|
|
import (
|
||
|
|
"testing"
|
||
|
|
|
||
|
|
"github.com/stretchr/testify/assert"
|
||
|
|
"github.com/zeromicro/go-zero/core/logx"
|
||
|
|
)
|
||
|
|
|
||
|
|
func TestCollector(t *testing.T) {
|
||
|
|
const input = "hello"
|
||
|
|
c := NewCollector(t)
|
||
|
|
logx.Info(input)
|
||
|
|
assert.Equal(t, input, c.Content())
|
||
|
|
assert.Contains(t, c.String(), input)
|
||
|
|
}
|
||
|
|
|
||
|
|
func TestDiscard(t *testing.T) {
|
||
|
|
const input = "hello"
|
||
|
|
Discard(t)
|
||
|
|
logx.Info(input)
|
||
|
|
}
|