Skip to content

Commit

Permalink
Add a test case for Go 1.16 template action newlines
Browse files Browse the repository at this point in the history
  • Loading branch information
bep committed Feb 18, 2021
1 parent cf3e077 commit ae57ba6
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions hugolib/template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -584,13 +584,30 @@ func TestTemplateGoIssues(t *testing.T) {
"index.html", `
{{ $title := "a & b" }}
<script type="application/ld+json">{"@type":"WebPage","headline":"{{$title}}"}</script>
{{/* Action newlines, from Go 1.16, see https://github.com/golang/go/issues/29770 */}}
{{ $norway := dict
"country" "Norway"
"population" "5 millions"
"language" "Norwegian"
"language_code" "nb"
"weather" "freezing cold"
"capitol" "Oslo"
"largest_city" "Oslo"
"currency" "Norwegian krone"
"dialing_code" "+47"
}}
Population in Norway is {{ $norway.population }}
`,
)

b.Build(BuildCfg{})

b.AssertFileContent("public/index.html", `
<script type="application/ld+json">{"@type":"WebPage","headline":"a \u0026 b"}</script>
Population in Norway is 5 millions
`)
}
Expand Down

0 comments on commit ae57ba6

Please sign in to comment.