Fix rebuilds when running hugo -w · gohugoio/hugo@7203a95 (original) (raw)
`@@ -121,14 +121,23 @@ func TestRebuildEditTextFileInBranchBundle(t *testing.T) {
`
121
121
`b.AssertRenderCountContent(1)
`
122
122
`}
`
123
123
``
``
124
`+
func testRebuildBothWatchingAndRunning(t *testing.T, files string, withB func(b *IntegrationTestBuilder)) {
`
``
125
`+
t.Helper()
`
``
126
`+
for _, opt := range []TestOpt{TestOptWatching(), TestOptRunning()} {
`
``
127
`+
b := Test(t, files, opt)
`
``
128
`+
withB(b)
`
``
129
`+
}
`
``
130
`+
}
`
``
131
+
124
132
`func TestRebuildRenameTextFileInLeafBundle(t *testing.T) {
`
125
``
`-
b := TestRunning(t, rebuildFilesSimple)
`
126
``
`-
b.AssertFileContent("public/mysection/mysectionbundle/index.html", "My Section Bundle Text 2 Content.", "Len Resources: 2|")
`
``
133
`+
testRebuildBothWatchingAndRunning(t, rebuildFilesSimple, func(b *IntegrationTestBuilder) {
`
``
134
`+
b.AssertFileContent("public/mysection/mysectionbundle/index.html", "My Section Bundle Text 2 Content.", "Len Resources: 2|")
`
127
135
``
128
``
`-
b.RenameFile("content/mysection/mysectionbundle/mysectionbundletext.txt", "content/mysection/mysectionbundle/mysectionbundletext2.txt").Build()
`
129
``
`-
b.AssertFileContent("public/mysection/mysectionbundle/index.html", "mysectionbundletext2", "My Section Bundle Text 2 Content.", "Len Resources: 2|")
`
130
``
`-
b.AssertRenderCountPage(3)
`
131
``
`-
b.AssertRenderCountContent(3)
`
``
136
`+
b.RenameFile("content/mysection/mysectionbundle/mysectionbundletext.txt", "content/mysection/mysectionbundle/mysectionbundletext2.txt").Build()
`
``
137
`+
b.AssertFileContent("public/mysection/mysectionbundle/index.html", "mysectionbundletext2", "My Section Bundle Text 2 Content.", "Len Resources: 2|")
`
``
138
`+
b.AssertRenderCountPage(3)
`
``
139
`+
b.AssertRenderCountContent(3)
`
``
140
`+
})
`
132
141
`}
`
133
142
``
134
143
`func TestRebuilEditContentFileInLeafBundle(t *testing.T) {
`
`@@ -367,8 +376,6 @@ My short.
`
367
376
`}
`
368
377
``
369
378
`func TestRebuildBaseof(t *testing.T) {
`
370
``
`-
t.Parallel()
`
371
``
-
372
379
`` files := `
``
373
380
`-- hugo.toml --
`
374
381
`title = "Hugo Site"
`
`@@ -383,12 +390,13 @@ Baseof: {{ .Title }}|
`
383
390
`Home: {{ .Title }}|{{ .Content }}|
`
384
391
`{{ end }}
`
385
392
`` `
``
386
``
`-
b := Test(t, files, TestOptRunning())
`
387
``
`-
b.AssertFileContent("public/index.html", "Baseof: Hugo Site|", "Home: Hugo Site||")
`
388
``
`-
b.EditFileReplaceFunc("layouts/_default/baseof.html", func(s string) string {
`
389
``
`-
return strings.Replace(s, "Baseof", "Baseof Edited", 1)
`
390
``
`-
}).Build()
`
391
``
`-
b.AssertFileContent("public/index.html", "Baseof Edited: Hugo Site|", "Home: Hugo Site||")
`
``
393
`+
testRebuildBothWatchingAndRunning(t, files, func(b *IntegrationTestBuilder) {
`
``
394
`+
b.AssertFileContent("public/index.html", "Baseof: Hugo Site|", "Home: Hugo Site||")
`
``
395
`+
b.EditFileReplaceFunc("layouts/_default/baseof.html", func(s string) string {
`
``
396
`+
return strings.Replace(s, "Baseof", "Baseof Edited", 1)
`
``
397
`+
}).Build()
`
``
398
`+
b.AssertFileContent("public/index.html", "Baseof Edited: Hugo Site|", "Home: Hugo Site||")
`
``
399
`+
})
`
392
400
`}
`
393
401
``
394
402
`func TestRebuildSingleWithBaseof(t *testing.T) {
`