mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
Add test for Hugo hanging up with empty content
This adds a test for the issue #1797 and its fix in 68e2e63
.
This commit is contained in:
parent
d1b0290fef
commit
2b3b90a6df
1 changed files with 32 additions and 0 deletions
|
@ -21,6 +21,7 @@ import (
|
|||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"bitbucket.org/pkg/inflect"
|
||||
|
||||
|
@ -64,6 +65,37 @@ more text
|
|||
`
|
||||
)
|
||||
|
||||
// Issue #1797
|
||||
func TestReadPagesFromSourceWithEmptySource(t *testing.T) {
|
||||
viper.Reset()
|
||||
defer viper.Reset()
|
||||
|
||||
viper.Set("DefaultExtension", "html")
|
||||
viper.Set("verbose", true)
|
||||
viper.Set("baseurl", "http://auth/bub")
|
||||
|
||||
sources := []source.ByteSource{}
|
||||
|
||||
s := &Site{
|
||||
Source: &source.InMemorySource{ByteSource: sources},
|
||||
Targets: targetList{Page: &target.PagePub{UglyURLs: true}},
|
||||
}
|
||||
|
||||
var err error
|
||||
d := time.Second * 2
|
||||
ticker := time.NewTicker(d)
|
||||
select {
|
||||
case err = <-s.ReadPagesFromSource():
|
||||
break
|
||||
case <-ticker.C:
|
||||
err = fmt.Errorf("ReadPagesFromSource() never returns in %s", d.String())
|
||||
}
|
||||
ticker.Stop()
|
||||
if err != nil {
|
||||
t.Fatalf("Unable to read source: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
func createAndRenderPages(t *testing.T, s *Site) {
|
||||
if err := s.CreatePages(); err != nil {
|
||||
t.Fatalf("Unable to create pages: %s", err)
|
||||
|
|
Loading…
Reference in a new issue