diff options
Diffstat (limited to 'helpers/pathspec_test.go')
-rw-r--r-- | helpers/pathspec_test.go | 38 |
1 files changed, 26 insertions, 12 deletions
diff --git a/helpers/pathspec_test.go b/helpers/pathspec_test.go index 42d828519..07948bb65 100644 --- a/helpers/pathspec_test.go +++ b/helpers/pathspec_test.go @@ -23,17 +23,24 @@ import ( ) func TestNewPathSpecFromConfig(t *testing.T) { - viper.Set("disablePathToLower", true) - viper.Set("removePathAccents", true) - viper.Set("uglyURLs", true) - viper.Set("multilingual", true) - viper.Set("defaultContentLanguageInSubdir", true) - viper.Set("defaultContentLanguage", "no") - viper.Set("currentContentLanguage", NewLanguage("no")) - viper.Set("canonifyURLs", true) - viper.Set("paginatePath", "side") - - p := NewPathSpec(hugofs.NewMem(), viper.GetViper()) + v := viper.New() + l := NewLanguage("no", v) + v.Set("disablePathToLower", true) + v.Set("removePathAccents", true) + v.Set("uglyURLs", true) + v.Set("multilingual", true) + v.Set("defaultContentLanguageInSubdir", true) + v.Set("defaultContentLanguage", "no") + v.Set("canonifyURLs", true) + v.Set("paginatePath", "side") + v.Set("baseURL", "http://base.com") + v.Set("themesDir", "thethemes") + v.Set("layoutDir", "thelayouts") + v.Set("workingDir", "thework") + v.Set("staticDir", "thestatic") + v.Set("theme", "thetheme") + + p := NewPathSpec(hugofs.NewMem(v), l) require.True(t, p.canonifyURLs) require.True(t, p.defaultContentLanguageInSubdir) @@ -42,6 +49,13 @@ func TestNewPathSpecFromConfig(t *testing.T) { require.True(t, p.removePathAccents) require.True(t, p.uglyURLs) require.Equal(t, "no", p.defaultContentLanguage) - require.Equal(t, "no", p.currentContentLanguage.Lang) + require.Equal(t, "no", p.language.Lang) require.Equal(t, "side", p.paginatePath) + + require.Equal(t, "http://base.com", p.baseURL) + require.Equal(t, "thethemes", p.themesDir) + require.Equal(t, "thelayouts", p.layoutDir) + require.Equal(t, "thework", p.workingDir) + require.Equal(t, "thestatic", p.staticDir) + require.Equal(t, "thetheme", p.theme) } |