github.com/rita33cool1/iot-system-gateway@v0.0.0-20200911033302-e65bde238cc5/docker-engine/daemon/logger/templates/templates_test.go (about) 1 package templates // import "github.com/docker/docker/daemon/logger/templates" 2 3 import ( 4 "bytes" 5 "testing" 6 7 "github.com/gotestyourself/gotestyourself/assert" 8 is "github.com/gotestyourself/gotestyourself/assert/cmp" 9 ) 10 11 func TestNewParse(t *testing.T) { 12 tm, err := NewParse("foo", "this is a {{ . }}") 13 assert.Check(t, err) 14 15 var b bytes.Buffer 16 assert.Check(t, tm.Execute(&b, "string")) 17 want := "this is a string" 18 assert.Check(t, is.Equal(want, b.String())) 19 }