"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "hugolib/config_test.go" between
hugo-0.85.0.tar.gz and hugo-0.86.0.tar.gz

About: Hugo is a static site generator that takes a source directory of Markdown files and templates and uses these as input to create a complete website (written in Go).

config_test.go  (hugo-0.85.0):config_test.go  (hugo-0.86.0)
skipping to change at line 23 skipping to change at line 23
package hugolib package hugolib
import ( import (
"bytes" "bytes"
"fmt" "fmt"
"path/filepath" "path/filepath"
"strings" "strings"
"testing" "testing"
"github.com/gohugoio/hugo/config"
"github.com/gohugoio/hugo/media" "github.com/gohugoio/hugo/media"
"github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp"
qt "github.com/frankban/quicktest" qt "github.com/frankban/quicktest"
"github.com/gohugoio/hugo/common/maps" "github.com/gohugoio/hugo/common/maps"
"github.com/spf13/afero" "github.com/spf13/afero"
) )
func TestLoadConfig(t *testing.T) { func TestLoadConfig(t *testing.T) {
t.Parallel()
c := qt.New(t) c := qt.New(t)
// Add a random config variable for testing. loadConfig := func(c *qt.C, configContent string, fromDir bool) config.Pr
// side = page in Norwegian. ovider {
configContent := ` mm := afero.NewMemMapFs()
PaginatePath = "side" filename := "config.toml"
` descriptor := ConfigSourceDescriptor{Fs: mm}
if fromDir {
mm := afero.NewMemMapFs() filename = filepath.Join("config", "_default", filename)
descriptor.AbsConfigDir = "config"
writeToFs(t, mm, "hugo.toml", configContent) }
writeToFs(t, mm, filename, configContent)
cfg, _, err := LoadConfig(ConfigSourceDescriptor{Fs: mm, Filename: "hugo. cfg, _, err := LoadConfig(descriptor)
toml"}) c.Assert(err, qt.IsNil)
c.Assert(err, qt.IsNil) return cfg
}
c.Assert(cfg.GetString("paginatePath"), qt.Equals, "side")
c.Run("Basic", func(c *qt.C) {
c.Parallel()
// Add a random config variable for testing.
// side = page in Norwegian.
cfg := loadConfig(c, `PaginatePath = "side"`, false)
c.Assert(cfg.GetString("paginatePath"), qt.Equals, "side")
})
// Issue #8763
for _, fromDir := range []bool{false, true} {
testName := "Taxonomy overrides"
if fromDir {
testName += " from dir"
}
c.Run(testName, func(c *qt.C) {
c.Parallel()
cfg := loadConfig(c, `[taxonomies]
appellation = "appellations"
vigneron = "vignerons"`, fromDir)
c.Assert(cfg.Get("taxonomies"), qt.DeepEquals, maps.Param
s{
"appellation": "appellations",
"vigneron": "vignerons",
})
})
}
} }
func TestLoadMultiConfig(t *testing.T) { func TestLoadMultiConfig(t *testing.T) {
t.Parallel() t.Parallel()
c := qt.New(t) c := qt.New(t)
// Add a random config variable for testing. // Add a random config variable for testing.
// side = page in Norwegian. // side = page in Norwegian.
configContentBase := ` configContentBase := `
 End of changes. 3 change blocks. 
16 lines changed or deleted 44 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)