Skip to content
Next Next commit
Update test to new error message in go 1.16 (nicksnyder#260)
  • Loading branch information
jawn-smith authored Jun 23, 2021
commit dadad2bdb2a713748df0717eddd54495150cfb58
7 changes: 4 additions & 3 deletions v2/internal/template_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package internal

import (
"strings"
"testing"
"text/template"
)
Expand Down Expand Up @@ -45,16 +46,16 @@ func TestExecute(t *testing.T) {
template: &Template{
Src: "hello {{",
},
err: "template: :1: unexpected unclosed action in command",
err: "unclosed action",
noallocs: true,
},
}

for _, test := range tests {
t.Run(test.template.Src, func(t *testing.T) {
result, err := test.template.Execute(test.funcs, test.data)
if actual := str(err); actual != test.err {
t.Errorf("expected err %q; got %q", test.err, actual)
if actual := str(err); !strings.Contains(str(err), test.err) {
t.Errorf("expected err %q to contain %q", actual, test.err)
}
if result != test.result {
t.Errorf("expected result %q; got %q", test.result, result)
Expand Down