From 072aa7f110ddc8a8b9dbc6d4cad3e5ba6c2ac4d0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Wed, 24 Jul 2019 10:05:09 +0200 Subject: [PATCH] hugolib: Add a symdiff test --- hugolib/collections_test.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/hugolib/collections_test.go b/hugolib/collections_test.go index 41681bc7..06bac80a 100644 --- a/hugolib/collections_test.go +++ b/hugolib/collections_test.go @@ -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) { -- 2.30.2