diff options
Diffstat (limited to 'hugolib/rss_test.go')
-rw-r--r-- | hugolib/rss_test.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/hugolib/rss_test.go b/hugolib/rss_test.go index 0a7f84a42..0d14bf5d6 100644 --- a/hugolib/rss_test.go +++ b/hugolib/rss_test.go @@ -15,6 +15,7 @@ package hugolib import ( "path/filepath" + "strings" "testing" "github.com/spf13/hugo/deps" @@ -27,11 +28,14 @@ func TestRSSOutput(t *testing.T) { th = testHelper{cfg} ) + rssLimit := len(weightedSources) - 1 + rssURI := "customrss.xml" cfg.Set("baseURL", "http://auth/bub/") cfg.Set("rssURI", rssURI) cfg.Set("title", "RSSTest") + cfg.Set("rssLimit", rssLimit) for _, src := range weightedSources { writeSource(t, fs, filepath.Join("content", "sect", src.Name), string(src.Content)) @@ -46,4 +50,10 @@ func TestRSSOutput(t *testing.T) { // Taxonomy RSS th.assertFileContent(t, fs, filepath.Join("public", "categories", "hugo", rssURI), true, "<?xml", "rss version", "Hugo on RSSTest") + // RSS Item Limit + content := readDestination(t, fs, filepath.Join("public", rssURI)) + c := strings.Count(content, "<item>") + if c != rssLimit { + t.Errorf("incorrect RSS item count: expected %d, got %d", rssLimit, c) + } } |