templates_test.go 328 B

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