2018-02-05 16:05:59 -05:00
|
|
|
package templates // import "github.com/docker/docker/daemon/logger/templates"
|
2017-08-08 12:16:41 -04:00
|
|
|
|
|
|
|
import (
|
|
|
|
"bytes"
|
|
|
|
"testing"
|
|
|
|
|
2018-06-11 09:32:11 -04:00
|
|
|
"gotest.tools/assert"
|
|
|
|
is "gotest.tools/assert/cmp"
|
2017-08-08 12:16:41 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestNewParse(t *testing.T) {
|
|
|
|
tm, err := NewParse("foo", "this is a {{ . }}")
|
2018-03-13 15:28:34 -04:00
|
|
|
assert.Check(t, err)
|
2017-08-08 12:16:41 -04:00
|
|
|
|
|
|
|
var b bytes.Buffer
|
2018-03-13 15:28:34 -04:00
|
|
|
assert.Check(t, tm.Execute(&b, "string"))
|
2017-08-08 12:16:41 -04:00
|
|
|
want := "this is a string"
|
2018-03-13 15:28:34 -04:00
|
|
|
assert.Check(t, is.Equal(want, b.String()))
|
2017-08-08 12:16:41 -04:00
|
|
|
}
|