summaryrefslogtreecommitdiffstats
path: root/hugolib/site_test.go
diff options
context:
space:
mode:
authorTatsushi Demachi <tdemachi@gmail.com>2016-02-08 20:55:19 +0900
committerTatsushi Demachi <tdemachi@gmail.com>2016-02-08 20:55:19 +0900
commit2b3b90a6dfc30677c6cd20e5a34a7c8243ba9145 (patch)
treed8da585f7463b94b7ece26c5f9409937b66de88e /hugolib/site_test.go
parentd1b0290fef8be78a2eb9c8497e0312ccfc4adc82 (diff)
Add test for Hugo hanging up with empty content
This adds a test for the issue #1797 and its fix in 68e2e63.
Diffstat (limited to 'hugolib/site_test.go')
-rw-r--r--hugolib/site_test.go32
1 files changed, 32 insertions, 0 deletions
diff --git a/hugolib/site_test.go b/hugolib/site_test.go
index 68fb5e5fc..482e2f791 100644
--- a/hugolib/site_test.go
+++ b/hugolib/site_test.go
@@ -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)