github.com/v2pro/plz@v0.0.0-20221028024117-e5f9aec5b631/countlog/output/printf/printf_test.go (about) 1 package printf 2 3 import ( 4 "testing" 5 "github.com/v2pro/plz/countlog/spi" 6 "github.com/stretchr/testify/require" 7 "os" 8 "io/ioutil" 9 ) 10 11 func Test_message(t *testing.T) { 12 should := require.New(t) 13 format := &Format{} 14 formatter := format.FormatterOf(&spi.LogSite{ 15 Event: "hello {key}", 16 Sample: []interface{}{"key", "world"}, 17 }) 18 output := formatter.Format(nil, &spi.Event{ 19 Properties: []interface{}{"key", "world"}, 20 }) 21 should.Equal("hello world", string(output)) 22 }