package message import ( "strings" "testing" ) type testmail struct { Message string } func (t testmail) Subject() string { return "Test Test" } func (t testmail) HtmlBody() (string, error) { content := `

{{.Message}}

` return render(layout, content, t) } func TestRender(t *testing.T) { tpl := testmail{ Message: "some mesage", } if b, err := tpl.HtmlBody(); err != nil { t.Error(err) } else if !strings.Contains(b, tpl.Message) { t.Error("supposed to contain:", tpl.Message) } }