summaryrefslogtreecommitdiffstats
path: root/hugolib/hugo_smoke_test.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2019-09-12 19:53:31 +0200
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2019-09-12 20:58:06 +0200
commitc0d7573677e9726c14749ccd432dccb75e0d194d (patch)
tree7c77b664ea6a24947d6fceea6aefede8a6fc801e /hugolib/hugo_smoke_test.go
parentfcfa6f33bbebc128a3f9bc3162173bc3780c5f50 (diff)
Fix cache keys for bundled resoures in transform.Unmarshal
Fixes #6327
Diffstat (limited to 'hugolib/hugo_smoke_test.go')
-rw-r--r--hugolib/hugo_smoke_test.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/hugolib/hugo_smoke_test.go b/hugolib/hugo_smoke_test.go
index 539e79729..0cb130960 100644
--- a/hugolib/hugo_smoke_test.go
+++ b/hugolib/hugo_smoke_test.go
@@ -301,3 +301,33 @@ The content.
b.CreateSites().Build(BuildCfg{})
}
+
+func TestBundleMany(t *testing.T) {
+
+ b := newTestSitesBuilder(t).WithSimpleConfigFile()
+ for i := 1; i <= 50; i++ {
+ b.WithContent(fmt.Sprintf("bundle%d/index.md", i), fmt.Sprintf(`
+---
+title: "Page %d"
+---
+
+`, i))
+ b.WithSourceFile(fmt.Sprintf("content/bundle%d/data.yaml", i), fmt.Sprintf(`
+data: v%d
+`, i))
+ }
+
+ b.WithTemplatesAdded("_default/single.html", `
+{{ $yaml := .Resources.GetMatch "*.yaml" }}
+{{ $data := $yaml | transform.Unmarshal }}
+data content: {{ $yaml.Content | safeHTML }}
+data unmarshaled: {{ $data.data }}
+`)
+
+ b.CreateSites().Build(BuildCfg{})
+
+ for i := 1; i <= 50; i++ {
+ b.AssertFileContent(fmt.Sprintf("public/bundle%d/data.yaml", i), fmt.Sprintf("data: v%d", i))
+ b.AssertFileContent(fmt.Sprintf("public/bundle%d/index.html", i), fmt.Sprintf("data unmarshaled: v%d", i))
+ }
+}