tpl/internal: Synch Go templates fork with Go 1.16dev

This commit is contained in:
Bjørn Erik Pedersen
2020-12-03 13:50:17 +01:00
parent 66beac99c6
commit cf3e077da3
25 changed files with 2520 additions and 137 deletions

View File

@@ -11,7 +11,7 @@ import (
"errors"
"flag"
"fmt"
"io/ioutil"
"io"
"reflect"
"strings"
"testing"
@@ -1297,7 +1297,7 @@ func TestUnterminatedStringError(t *testing.T) {
t.Fatal("expected error")
}
str := err.Error()
if !strings.Contains(str, "X:3: unexpected unterminated raw quoted string") {
if !strings.Contains(str, "X:3: unterminated raw quoted string") {
t.Fatalf("unexpected error: %s", str)
}
}
@@ -1330,7 +1330,7 @@ func TestExecuteGivesExecError(t *testing.T) {
if err != nil {
t.Fatal(err)
}
err = tmpl.Execute(ioutil.Discard, 0)
err = tmpl.Execute(io.Discard, 0)
if err == nil {
t.Fatal("expected error; got none")
}
@@ -1476,7 +1476,7 @@ func TestEvalFieldErrors(t *testing.T) {
for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) {
tmpl := Must(New("tmpl").Parse(tc.src))
err := tmpl.Execute(ioutil.Discard, tc.value)
err := tmpl.Execute(io.Discard, tc.value)
got := "<nil>"
if err != nil {
got = err.Error()
@@ -1493,7 +1493,7 @@ func TestMaxExecDepth(t *testing.T) {
t.Skip("skipping in -short mode")
}
tmpl := Must(New("tmpl").Parse(`{{template "tmpl" .}}`))
err := tmpl.Execute(ioutil.Discard, nil)
err := tmpl.Execute(io.Discard, nil)
got := "<nil>"
if err != nil {
got = err.Error()