mirror of
https://github.com/gohugoio/hugo.git
synced 2024-07-01 01:29:54 +00:00
Unexport ShouldBuild and AssertShouldBuild
This commit is contained in:
parent
eeaafb4b26
commit
8588103316
|
@ -467,12 +467,12 @@ func (p *Page) LinkTitle() string {
|
||||||
return p.Title
|
return p.Title
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Page) ShouldBuild() bool {
|
func (p *Page) shouldBuild() bool {
|
||||||
return AssertShouldBuild(viper.GetBool("BuildFuture"), viper.GetBool("BuildExpired"),
|
return shouldBuild(viper.GetBool("BuildFuture"), viper.GetBool("BuildExpired"),
|
||||||
viper.GetBool("BuildDrafts"), p.Draft, p.PublishDate, p.ExpiryDate)
|
viper.GetBool("BuildDrafts"), p.Draft, p.PublishDate, p.ExpiryDate)
|
||||||
}
|
}
|
||||||
|
|
||||||
func AssertShouldBuild(buildFuture bool, buildExpired bool, buildDrafts bool, Draft bool,
|
func shouldBuild(buildFuture bool, buildExpired bool, buildDrafts bool, Draft bool,
|
||||||
publishDate time.Time, expiryDate time.Time) bool {
|
publishDate time.Time, expiryDate time.Time) bool {
|
||||||
if !(buildDrafts || !Draft) {
|
if !(buildDrafts || !Draft) {
|
||||||
return false
|
return false
|
||||||
|
|
|
@ -1090,7 +1090,7 @@ func compareObjects(a interface{}, b interface{}) bool {
|
||||||
return strings.Join(aStr, "") == strings.Join(bStr, "")
|
return strings.Join(aStr, "") == strings.Join(bStr, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAssertShouldBuild(t *testing.T) {
|
func TestShouldBuild(t *testing.T) {
|
||||||
var past = time.Date(2009, 11, 17, 20, 34, 58, 651387237, time.UTC)
|
var past = time.Date(2009, 11, 17, 20, 34, 58, 651387237, time.UTC)
|
||||||
var future = time.Date(2037, 11, 17, 20, 34, 58, 651387237, time.UTC)
|
var future = time.Date(2037, 11, 17, 20, 34, 58, 651387237, time.UTC)
|
||||||
var zero = time.Time{}
|
var zero = time.Time{}
|
||||||
|
@ -1128,7 +1128,7 @@ func TestAssertShouldBuild(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, ps := range publishSettings {
|
for _, ps := range publishSettings {
|
||||||
s := AssertShouldBuild(ps.buildFuture, ps.buildExpired, ps.buildDrafts, ps.draft,
|
s := shouldBuild(ps.buildFuture, ps.buildExpired, ps.buildDrafts, ps.draft,
|
||||||
ps.publishDate, ps.expiryDate)
|
ps.publishDate, ps.expiryDate)
|
||||||
if s != ps.out {
|
if s != ps.out {
|
||||||
t.Errorf("AssertShouldBuild unexpected output with params: %+v", ps)
|
t.Errorf("AssertShouldBuild unexpected output with params: %+v", ps)
|
||||||
|
|
|
@ -996,7 +996,7 @@ func converterCollator(s *Site, results <-chan HandledResult, errs chan<- error)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Site) addPage(page *Page) {
|
func (s *Site) addPage(page *Page) {
|
||||||
if page.ShouldBuild() {
|
if page.shouldBuild() {
|
||||||
s.Pages = append(s.Pages, page)
|
s.Pages = append(s.Pages, page)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue