summaryrefslogtreecommitdiffstats
path: root/hugolib/site_output_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'hugolib/site_output_test.go')
-rw-r--r--hugolib/site_output_test.go56
1 files changed, 55 insertions, 1 deletions
diff --git a/hugolib/site_output_test.go b/hugolib/site_output_test.go
index 2935f3257..d57173630 100644
--- a/hugolib/site_output_test.go
+++ b/hugolib/site_output_test.go
@@ -31,7 +31,7 @@ import (
func TestDefaultOutputFormats(t *testing.T) {
t.Parallel()
- defs, err := createDefaultOutputFormats(viper.New())
+ defs, err := createDefaultOutputFormats(output.DefaultFormats, viper.New())
require.NoError(t, err)
@@ -53,6 +53,30 @@ func TestDefaultOutputFormats(t *testing.T) {
}
}
+func TestDefaultOutputFormatsWithOverrides(t *testing.T) {
+ t.Parallel()
+
+ htmlOut := output.HTMLFormat
+ htmlOut.BaseName = "htmlindex"
+ rssOut := output.RSSFormat
+ rssOut.BaseName = "feed"
+
+ defs, err := createDefaultOutputFormats(output.Formats{htmlOut, rssOut}, viper.New())
+
+ homeDefs := defs[KindHome]
+
+ rss, found := homeDefs.GetByName("RSS")
+ require.True(t, found)
+ require.Equal(t, rss.BaseName, "feed")
+
+ html, found := homeDefs.GetByName("HTML")
+ require.True(t, found)
+ require.Equal(t, html.BaseName, "htmlindex")
+
+ require.NoError(t, err)
+
+}
+
func TestSiteWithPageOutputs(t *testing.T) {
for _, outputs := range [][]string{{"html", "json", "calendar"}, {"json"}} {
t.Run(fmt.Sprintf("%v", outputs), func(t *testing.T) {
@@ -231,3 +255,33 @@ Content: {{ .Content }}
}
}
+
+// Issue #3447
+func TestRedefineRSSOutputFormat(t *testing.T) {
+ siteConfig := `
+baseURL = "http://example.com/blog"
+
+paginate = 1
+defaultContentLanguage = "en"
+
+disableKinds = ["page", "section", "taxonomy", "taxonomyTerm", "sitemap", "robotsTXT", "404"]
+
+[outputFormats]
+[outputFormats.RSS]
+mediatype = "application/rss"
+baseName = "feed"
+
+`
+
+ mf := afero.NewMemMapFs()
+ writeToFs(t, mf, "content/foo.html", `foo`)
+
+ th, h := newTestSitesFromConfig(t, mf, siteConfig)
+
+ err := h.Build(BuildCfg{})
+
+ require.NoError(t, err)
+
+ th.assertFileContent("public/feed.xml", "Recent content on")
+
+}