mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
Move matchRender to test helpers file
This commit is contained in:
parent
99e250917d
commit
32d91d616e
2 changed files with 13 additions and 12 deletions
|
@ -1,6 +1,7 @@
|
|||
package hugolib
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"github.com/spf13/afero"
|
||||
|
@ -78,3 +79,15 @@ func pageMust(p *Page, err error) *Page {
|
|||
}
|
||||
return p
|
||||
}
|
||||
|
||||
func matchRender(t *testing.T, s *Site, p *Page, tmplName string, expected string) {
|
||||
content := new(bytes.Buffer)
|
||||
err := s.renderThing(p, tmplName, NopCloser(content))
|
||||
if err != nil {
|
||||
t.Fatalf("Unable to render template.")
|
||||
}
|
||||
|
||||
if string(content.Bytes()) != expected {
|
||||
t.Fatalf("Content did not match expected: %s. got: %s", expected, content)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -79,18 +79,6 @@ func NopCloser(w io.Writer) io.WriteCloser {
|
|||
return nopCloser{w}
|
||||
}
|
||||
|
||||
func matchRender(t *testing.T, s *Site, p *Page, tmplName string, expected string) {
|
||||
content := new(bytes.Buffer)
|
||||
err := s.renderThing(p, tmplName, NopCloser(content))
|
||||
if err != nil {
|
||||
t.Fatalf("Unable to render template.")
|
||||
}
|
||||
|
||||
if string(content.Bytes()) != expected {
|
||||
t.Fatalf("Content did not match expected: %s. got: %s", expected, content)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRenderThing(t *testing.T) {
|
||||
tests := []struct {
|
||||
content string
|
||||
|
|
Loading…
Reference in a new issue