hugolib: Add a symdiff test

This commit is contained in:
Bjørn Erik Pedersen 2019-07-24 10:05:09 +02:00
parent 215d2ed883
commit 072aa7f110
No known key found for this signature in database
GPG key ID: 330E6E2BD4859D8F

View file

@ -141,6 +141,13 @@ tags_weight: %d
{{ printf "uniqPages: %T %d" $uniqPages (len $uniqPages) }}
{{ printf "inTrue: %t" $inTrue }}
{{ printf "inFalse: %t" $inFalse }}
`)
b.WithTemplatesAdded("_default/single.html", `
{{ $related := .Site.RegularPages.Related . }}
{{ $symdiff := $related | symdiff .Site.RegularPages }}
Related: {{ range $related }}{{ .RelPermalink }}|{{ end }}
Symdiff: {{ range $symdiff }}{{ .RelPermalink }}|{{ end }}
`)
b.CreateSites().Build(BuildCfg{})
@ -152,6 +159,8 @@ tags_weight: %d
"inTrue: true",
"inFalse: false",
)
b.AssertFileContent("public/page1/index.html", `Related: /page2/|/page3/|`, `Symdiff: /page1/|`)
}
func TestAppendFunc(t *testing.T) {