Skip to content

Commit

Permalink
File...
Browse files Browse the repository at this point in the history
  • Loading branch information
bep committed Jan 4, 2019
1 parent 416ab78 commit b0793b4
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 16 deletions.
4 changes: 2 additions & 2 deletions hugolib/pagination_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func TestSplitPageGroups(t *testing.T) {
// first group 10 in weight
require.Equal(t, 10, pg.Key)
for _, p := range pg.Pages {
require.True(t, p.(*Page).fuzzyWordCount%2 == 0) // magic test
require.True(t, p.FuzzyWordCount()%2 == 0) // magic test
}
}
} else {
Expand All @@ -75,7 +75,7 @@ func TestSplitPageGroups(t *testing.T) {
// last should have 5 in weight
require.Equal(t, 5, pg.Key)
for _, p := range pg.Pages {
require.True(t, p.(*Page).fuzzyWordCount%2 != 0) // magic test
require.True(t, p.FuzzyWordCount()%2 != 0) // magic test
}
}
} else {
Expand Down
4 changes: 2 additions & 2 deletions hugolib/site_sections_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,13 @@ PAG|{{ .Title }}|{{ $sect.InSection . }}
{"elsewhere", func(p page.Page) {
assert.Len(p.Pages(), 1)
for _, p := range p.Pages() {
assert.Equal([]string{"elsewhere"}, p.(*Page).sections)
assert.Equal("elsewhere", p.SectionsPath())
}
}},
{"post", func(p page.Page) {
assert.Len(p.Pages(), 2)
for _, p := range p.Pages() {
assert.Equal("post", p.(*Page).Section())
assert.Equal("post", p.Section())
}
}},
{"empty1", func(p page.Page) {
Expand Down
8 changes: 4 additions & 4 deletions resources/page/page.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"github.com/gohugoio/hugo/compare"
"github.com/gohugoio/hugo/related"
"github.com/gohugoio/hugo/resources/resource"
"github.com/gohugoio/hugo/source"
)

// TODO(bep) page there is language and stuff going on. There will be
Expand Down Expand Up @@ -62,9 +63,6 @@ type pageAddons interface {

OutputFormats() OutputFormats

// Path is a path to this page resource with Unix-style slashes.
Path() string

// SectionsPath is path to this page's section with Unix-style slashes.
SectionsPath() string

Expand All @@ -84,7 +82,6 @@ type pageAddons interface {
}

type pageAddons2 interface {
Section() string
Type() string
BundleType() string
Parent() Page
Expand Down Expand Up @@ -131,6 +128,9 @@ type pageAddons6 interface {
ReadingTime() int

Summary() template.HTML

// TODO(bep) page consider what to do.
source.File
}

//
Expand Down
88 changes: 80 additions & 8 deletions resources/page/testhelpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
package page

import (
"html/template"
"os"
"time"

"github.com/gohugoio/hugo/langs"
Expand Down Expand Up @@ -94,10 +96,6 @@ func (p *testPage) LinkTitle() string {
return p.linkTitle
}

func (p *testPage) Path() string {
return p.path
}

func (p *testPage) SectionsPath() string {
panic("not implemented")
}
Expand Down Expand Up @@ -194,10 +192,6 @@ func (p *testPage) GetPageUpdater() PageUpdater {
return PageUpdater{}
}

func (p *testPage) Section() string {
panic("not implemented")
}

func (p *testPage) Type() string {
panic("not implemented")
}
Expand Down Expand Up @@ -261,3 +255,81 @@ func (p *testPage) IsDescendant(other interface{}) (bool, error) {
func (p *testPage) IsAncestor(other interface{}) (bool, error) {
panic("not implemented")
}

func (p *testPage) Next() Page {
panic("not implemented")
}

func (p *testPage) Prev() Page {
panic("not implemented")
}

func (p *testPage) WordCount() int {
panic("not implemented")
}

func (p *testPage) FuzzyWordCount() int {
panic("not implemented")
}

func (p *testPage) ReadingTime() int {
panic("not implemented")
}

func (p *testPage) Summary() template.HTML {
panic("not implemented")
}

// File

func (p *testPage) Filename() string {
panic("not implemented")
}

func (p *testPage) Path() string {
return p.path
}

func (p *testPage) Dir() string {
panic("not implemented")
}

func (p *testPage) Extension() string {
panic("not implemented")
}

func (p *testPage) Ext() string {
panic("not implemented")
}

func (p *testPage) Lang() string {
panic("not implemented")
}

func (p *testPage) LogicalName() string {
panic("not implemented")
}

func (p *testPage) Section() string {
panic("not implemented")
}

func (p *testPage) BaseFileName() string {
panic("not implemented")
}

func (p *testPage) TranslationBaseName() string {
panic("not implemented")
}

func (p *testPage) ContentBaseName() string {
panic("not implemented")
}

func (p *testPage) UniqueID() string {
panic("not implemented")
}

func (p *testPage) FileInfo() os.FileInfo {
panic("not implemented")
}

0 comments on commit b0793b4

Please sign in to comment.