mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
parent
95818e27dc
commit
7c647bcaeb
4 changed files with 35 additions and 1 deletions
5
cache/filecache/integration_test.go
vendored
5
cache/filecache/integration_test.go
vendored
|
@ -22,6 +22,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
qt "github.com/frankban/quicktest"
|
qt "github.com/frankban/quicktest"
|
||||||
|
"github.com/gohugoio/hugo/htesting"
|
||||||
"github.com/gohugoio/hugo/hugolib"
|
"github.com/gohugoio/hugo/hugolib"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -51,6 +52,10 @@ title: "Home"
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPruneImages(t *testing.T) {
|
func TestPruneImages(t *testing.T) {
|
||||||
|
if htesting.IsCI() {
|
||||||
|
// TODO(bep)
|
||||||
|
t.Skip("skip flaky test on CI server")
|
||||||
|
}
|
||||||
files := `
|
files := `
|
||||||
-- hugo.toml --
|
-- hugo.toml --
|
||||||
baseURL = "https://example.com"
|
baseURL = "https://example.com"
|
||||||
|
|
|
@ -367,7 +367,7 @@ type ConfigCompiled struct {
|
||||||
func (c *ConfigCompiled) SetMainSectionsIfNotSet(sections []string) {
|
func (c *ConfigCompiled) SetMainSectionsIfNotSet(sections []string) {
|
||||||
c.mu.Lock()
|
c.mu.Lock()
|
||||||
defer c.mu.Unlock()
|
defer c.mu.Unlock()
|
||||||
if len(c.MainSections) > 0 {
|
if c.MainSections != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
c.MainSections = sections
|
c.MainSections = sections
|
||||||
|
|
|
@ -177,6 +177,9 @@ var allDecoderSetups = map[string]decodeWeight{
|
||||||
// Before Hugo 0.112.0 this was configured via site Params.
|
// Before Hugo 0.112.0 this was configured via site Params.
|
||||||
if mainSections, found := p.c.Params["mainsections"]; found {
|
if mainSections, found := p.c.Params["mainsections"]; found {
|
||||||
p.c.MainSections = types.ToStringSlicePreserveString(mainSections)
|
p.c.MainSections = types.ToStringSlicePreserveString(mainSections)
|
||||||
|
if p.c.MainSections == nil {
|
||||||
|
p.c.MainSections = []string{}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -871,3 +871,29 @@ Param: svParamValue
|
||||||
`)
|
`)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestConfigEmptyMainSections(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
|
files := `
|
||||||
|
-- hugo.yml --
|
||||||
|
params:
|
||||||
|
mainSections:
|
||||||
|
-- content/mysection/_index.md --
|
||||||
|
-- content/mysection/mycontent.md --
|
||||||
|
-- layouts/index.html --
|
||||||
|
mainSections: {{ site.Params.mainSections }}
|
||||||
|
|
||||||
|
`
|
||||||
|
b := NewIntegrationTestBuilder(
|
||||||
|
IntegrationTestConfig{
|
||||||
|
T: t,
|
||||||
|
TxtarString: files,
|
||||||
|
},
|
||||||
|
).Build()
|
||||||
|
|
||||||
|
b.AssertFileContent("public/index.html", `
|
||||||
|
mainSections: []
|
||||||
|
`)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue