github.com/Heebron/moby@v0.0.0-20221111184709-6eab4f55faf7/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  	"gotest.tools/v3/assert"
     8  	is "gotest.tools/v3/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  }