Expand template newline testcase to commands
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Thu, 3 Dec 2020 15:42:24 +0000 (16:42 +0100)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Thu, 18 Feb 2021 13:11:48 +0000 (14:11 +0100)
hugolib/template_test.go

index 265cea1cb83c25d8d5f3f75355a12b3137e7828b..f487cec67ac784a01a2b036d3ed178436a56d00f 100644 (file)
@@ -585,7 +585,7 @@ func TestTemplateGoIssues(t *testing.T) {
 {{ $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 */}}
+{{/* Action/commands newlines, from Go 1.16, see https://github.com/golang/go/issues/29770 */}}
 {{ $norway := dict
        "country" "Norway"
        "population" "5 millions"
@@ -598,7 +598,11 @@ func TestTemplateGoIssues(t *testing.T) {
        "dialing_code" "+47"
 }}
 
-Population in Norway is {{ $norway.population }}
+Population in Norway is {{
+         $norway.population
+       | lower
+       | upper
+}}
 
 `,
        )
@@ -607,7 +611,7 @@ Population in Norway is {{ $norway.population }}
 
        b.AssertFileContent("public/index.html", `
 <script type="application/ld+json">{"@type":"WebPage","headline":"a \u0026 b"}</script>
-Population in Norway is 5 millions
+Population in Norway is 5 MILLIONS
 
 `)
 }