mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-17 21:01:26 +02:00
Fix erroneous warning with .Page.RenderString on a page without a backing file
Fixes #9433
This commit is contained in:
@@ -18,6 +18,7 @@ import (
|
||||
"testing"
|
||||
|
||||
qt "github.com/frankban/quicktest"
|
||||
"github.com/gohugoio/hugo/common/loggers"
|
||||
)
|
||||
|
||||
func TestRenderHookEditNestedPartial(t *testing.T) {
|
||||
@@ -484,3 +485,15 @@ func TestRenderStringOnListPage(t *testing.T) {
|
||||
b.AssertFileContent("public/"+filename, `<strong>Hello</strong>`)
|
||||
}
|
||||
}
|
||||
|
||||
// Issue 9433
|
||||
func TestRenderStringOnPageNotBackedByAFile(t *testing.T) {
|
||||
t.Parallel()
|
||||
logger := loggers.NewWarningLogger()
|
||||
b := newTestSitesBuilder(t).WithLogger(logger).WithConfigFile("toml", `
|
||||
disableKinds = ["page", "section", "taxonomy", "term"]
|
||||
`)
|
||||
b.WithTemplates("index.html", `{{ .RenderString "**Hello**" }}`).WithContent("p1.md", "")
|
||||
b.BuildE(BuildCfg{})
|
||||
b.Assert(int(logger.LogCounters().WarnCounter.Count()), qt.Equals, 0)
|
||||
}
|
||||
|
Reference in New Issue
Block a user