github.com/LazyboyChen7/engine@v17.12.1-ce-rc2+incompatible/daemon/logger/templates/templates_test.go (about)

     1  package templates
     2  
     3  import (
     4  	"bytes"
     5  	"testing"
     6  
     7  	"github.com/stretchr/testify/assert"
     8  )
     9  
    10  func TestNewParse(t *testing.T) {
    11  	tm, err := NewParse("foo", "this is a {{ . }}")
    12  	assert.NoError(t, err)
    13  
    14  	var b bytes.Buffer
    15  	assert.NoError(t, tm.Execute(&b, "string"))
    16  	want := "this is a string"
    17  	assert.Equal(t, want, b.String())
    18  }