diff options
author | Bjørn Erik Pedersen <[email protected]> | 2024-08-01 10:27:55 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2024-08-01 12:07:27 +0200 |
commit | 92573012e83bf8d71a247027d2f7f7f43a9c42b7 (patch) | |
tree | 7d4b67fdca04f8260c71f2a80d7187cda66d4c5d /tpl/internal | |
parent | 071f8b4466062da1758f34046947471d59a33b86 (diff) | |
download | hugo-92573012e83bf8d71a247027d2f7f7f43a9c42b7.tar.gz hugo-92573012e83bf8d71a247027d2f7f7f43a9c42b7.zip |
Bump to go 1.21 in go.mod
Diffstat (limited to 'tpl/internal')
13 files changed, 49 insertions, 49 deletions
diff --git a/tpl/internal/go_templates/htmltemplate/clone_test.go b/tpl/internal/go_templates/htmltemplate/clone_test.go index 7db335b5b..e42177a6b 100644 --- a/tpl/internal/go_templates/htmltemplate/clone_test.go +++ b/tpl/internal/go_templates/htmltemplate/clone_test.go @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build go1.13 && !windows -// +build go1.13,!windows +//go:build !windows +// +build !windows package template diff --git a/tpl/internal/go_templates/htmltemplate/content_test.go b/tpl/internal/go_templates/htmltemplate/content_test.go index fac4774cc..e886ee8ff 100644 --- a/tpl/internal/go_templates/htmltemplate/content_test.go +++ b/tpl/internal/go_templates/htmltemplate/content_test.go @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build go1.13 && !windows -// +build go1.13,!windows +//go:build !windows +// +build !windows package template @@ -428,7 +428,7 @@ func TestStringer(t *testing.T) { if err := tmpl.Execute(b, s); err != nil { t.Fatal(err) } - var expect = "string=3" + expect := "string=3" if b.String() != expect { t.Errorf("expected %q got %q", expect, b.String()) } diff --git a/tpl/internal/go_templates/htmltemplate/css_test.go b/tpl/internal/go_templates/htmltemplate/css_test.go index f44568930..f2b2add3a 100644 --- a/tpl/internal/go_templates/htmltemplate/css_test.go +++ b/tpl/internal/go_templates/htmltemplate/css_test.go @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build go1.13 && !windows -// +build go1.13,!windows +//go:build !windows +// +build !windows package template diff --git a/tpl/internal/go_templates/htmltemplate/escape_test.go b/tpl/internal/go_templates/htmltemplate/escape_test.go index b202afde0..66bf50203 100644 --- a/tpl/internal/go_templates/htmltemplate/escape_test.go +++ b/tpl/internal/go_templates/htmltemplate/escape_test.go @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build go1.13 && !windows -// +build go1.13,!windows +//go:build !windows +// +build !windows package template @@ -944,7 +944,6 @@ func TestEscapeSet(t *testing.T) { t.Errorf("want\n\t%q\ngot\n\t%q", test.want, got) } } - } func TestErrors(t *testing.T) { @@ -1194,7 +1193,6 @@ func TestErrors(t *testing.T) { // Check that we get the same error if we call Execute again. if err := tmpl.Execute(buf, nil); err == nil || err.Error() != got { t.Errorf("input=%q: unexpected error on second call %q", test.input, err) - } } } diff --git a/tpl/internal/go_templates/htmltemplate/example_test.go b/tpl/internal/go_templates/htmltemplate/example_test.go index 6485c7cfb..de81132c2 100644 --- a/tpl/internal/go_templates/htmltemplate/example_test.go +++ b/tpl/internal/go_templates/htmltemplate/example_test.go @@ -2,9 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build go1.13 -// +build go1.13 - package template_test import ( @@ -83,7 +80,6 @@ func Example() { // <div><strong>no rows</strong></div> // </body> // </html> - } func Example_autoescaping() { @@ -124,7 +120,6 @@ func Example_escape() { // \"Fran \u0026 Freddie\'s Diner\" \[email protected]\u003E // \"Fran \u0026 Freddie\'s Diner\"32\[email protected]\u003E // %22Fran+%26+Freddie%27s+Diner%2232%3Ctasty%40example.com%3E - } func ExampleTemplate_Delims() { diff --git a/tpl/internal/go_templates/htmltemplate/exec_test.go b/tpl/internal/go_templates/htmltemplate/exec_test.go index e91aeafa1..428cddc0d 100644 --- a/tpl/internal/go_templates/htmltemplate/exec_test.go +++ b/tpl/internal/go_templates/htmltemplate/exec_test.go @@ -4,8 +4,8 @@ // Tests for template execution, copied from text/template. -//go:build go1.13 && !windows -// +build go1.13,!windows +//go:build !windows +// +build !windows package template diff --git a/tpl/internal/go_templates/htmltemplate/html_test.go b/tpl/internal/go_templates/htmltemplate/html_test.go index 2809ee1e2..bea668ef9 100644 --- a/tpl/internal/go_templates/htmltemplate/html_test.go +++ b/tpl/internal/go_templates/htmltemplate/html_test.go @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build go1.13 && !windows -// +build go1.13,!windows +//go:build !windows +// +build !windows package template diff --git a/tpl/internal/go_templates/htmltemplate/js_test.go b/tpl/internal/go_templates/htmltemplate/js_test.go index c78f43b5f..61a601b02 100644 --- a/tpl/internal/go_templates/htmltemplate/js_test.go +++ b/tpl/internal/go_templates/htmltemplate/js_test.go @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build go1.13 && !windows -// +build go1.13,!windows +//go:build !windows +// +build !windows package template @@ -221,7 +221,8 @@ func TestJSStrEscaper(t *testing.T) { {"<!--", `\u003c!--`}, {"-->", `--\u003e`}, // From https://code.google.com/p/doctype/wiki/ArticleUtf7 - {"+ADw-script+AD4-alert(1)+ADw-/script+AD4-", + { + "+ADw-script+AD4-alert(1)+ADw-/script+AD4-", `\u002bADw-script\u002bAD4-alert(1)\u002bADw-\/script\u002bAD4-`, }, // Invalid UTF-8 sequence diff --git a/tpl/internal/go_templates/htmltemplate/multi_test.go b/tpl/internal/go_templates/htmltemplate/multi_test.go index f3e629b88..c320c4353 100644 --- a/tpl/internal/go_templates/htmltemplate/multi_test.go +++ b/tpl/internal/go_templates/htmltemplate/multi_test.go @@ -4,8 +4,8 @@ // Tests for multiple-template execution, copied from text/template. -//go:build go1.13 && !windows -// +build go1.13,!windows +//go:build !windows +// +build !windows package template @@ -268,7 +268,7 @@ func TestIssue19294(t *testing.T) { // by the contents of "stylesheet", but if the internal map associating // names with templates is built in the wrong order, the empty block // looks non-empty and this doesn't happen. - var inlined = map[string]string{ + inlined := map[string]string{ "stylesheet": `{{define "stylesheet"}}stylesheet{{end}}`, "xhtml": `{{block "stylesheet" .}}{{end}}`, } diff --git a/tpl/internal/go_templates/htmltemplate/template_test.go b/tpl/internal/go_templates/htmltemplate/template_test.go index 0838308a1..3a0f7463e 100644 --- a/tpl/internal/go_templates/htmltemplate/template_test.go +++ b/tpl/internal/go_templates/htmltemplate/template_test.go @@ -2,9 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build go1.13 -// +build go1.13 - package template_test import ( @@ -18,7 +15,6 @@ import ( ) func TestTemplateClone(t *testing.T) { - orig := New("name") clone, err := orig.Clone() if err != nil { diff --git a/tpl/internal/go_templates/htmltemplate/transition_test.go b/tpl/internal/go_templates/htmltemplate/transition_test.go index 0bd38800f..9eb36558b 100644 --- a/tpl/internal/go_templates/htmltemplate/transition_test.go +++ b/tpl/internal/go_templates/htmltemplate/transition_test.go @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build go1.13 && !windows -// +build go1.13,!windows +//go:build !windows +// +build !windows package template @@ -43,7 +43,6 @@ func TestFindEndTag(t *testing.T) { } func BenchmarkTemplateSpecialTags(b *testing.B) { - r := struct { Name, Gift string }{"Aunt Mildred", "bone china tea set"} diff --git a/tpl/internal/go_templates/htmltemplate/url_test.go b/tpl/internal/go_templates/htmltemplate/url_test.go index 72c8a4fe9..c7e67c211 100644 --- a/tpl/internal/go_templates/htmltemplate/url_test.go +++ b/tpl/internal/go_templates/htmltemplate/url_test.go @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build go1.13 && !windows -// +build go1.13,!windows +//go:build !windows +// +build !windows package template diff --git a/tpl/internal/go_templates/texttemplate/multi_test.go b/tpl/internal/go_templates/texttemplate/multi_test.go index 6e383c131..6358383e4 100644 --- a/tpl/internal/go_templates/texttemplate/multi_test.go +++ b/tpl/internal/go_templates/texttemplate/multi_test.go @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build go1.13 && !windows -// +build go1.13,!windows +//go:build !windows +// +build !windows package template @@ -11,10 +11,11 @@ package template import ( "fmt" - "github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate/parse" "os" "strings" "testing" + + "github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate/parse" ) const ( @@ -31,22 +32,32 @@ type multiParseTest struct { } var multiParseTests = []multiParseTest{ - {"empty", "", noError, + { + "empty", "", noError, + nil, nil, - nil}, - {"one", `{{define "foo"}} FOO {{end}}`, noError, + }, + { + "one", `{{define "foo"}} FOO {{end}}`, noError, []string{"foo"}, - []string{" FOO "}}, - {"two", `{{define "foo"}} FOO {{end}}{{define "bar"}} BAR {{end}}`, noError, + []string{" FOO "}, + }, + { + "two", `{{define "foo"}} FOO {{end}}{{define "bar"}} BAR {{end}}`, noError, []string{"foo", "bar"}, - []string{" FOO ", " BAR "}}, + []string{" FOO ", " BAR "}, + }, // errors - {"missing end", `{{define "foo"}} FOO `, hasError, + { + "missing end", `{{define "foo"}} FOO `, hasError, + nil, + nil, + }, + { + "malformed name", `{{define "foo}} FOO `, hasError, nil, - nil}, - {"malformed name", `{{define "foo}} FOO `, hasError, nil, - nil}, + }, } func TestMultiParse(t *testing.T) { @@ -432,7 +443,7 @@ func TestIssue19294(t *testing.T) { // by the contents of "stylesheet", but if the internal map associating // names with templates is built in the wrong order, the empty block // looks non-empty and this doesn't happen. - var inlined = map[string]string{ + inlined := map[string]string{ "stylesheet": `{{define "stylesheet"}}stylesheet{{end}}`, "xhtml": `{{block "stylesheet" .}}{{end}}`, } |