diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2023-07-27 13:00:01 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2023-07-27 15:51:25 +0200 |
commit | 7f058b8bab947db98939ed27a7c2a08468323d08 (patch) | |
tree | c3af23c64a0b11ad2687e34f984608710a5f4632 /hugolib | |
parent | 575d7f8068082bf75ee4939fafa186c796a06a0c (diff) |
Fix multiple languages in HUGO_DISABLELANGUAGES
Fixes #11278
Diffstat (limited to 'hugolib')
-rw-r--r-- | hugolib/config_test.go | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/hugolib/config_test.go b/hugolib/config_test.go index ff7b01a3f..a39d57781 100644 --- a/hugolib/config_test.go +++ b/hugolib/config_test.go @@ -259,6 +259,47 @@ sub: map[sub1:sub1en] } +func TestDisableRootSlicesFromEnv(t *testing.T) { + t.Parallel() + + files := ` +-- hugo.toml -- +baseURL = "https://example.com" +defaultContentLanguage = "en" +defaultContentLanguageInSubdir = true +[languages] +[languages.en] +weight = 1 +[languages.sv] +weight = 2 +[languages.no] +weight = 3 + +-- layouts/index.html -- +Home. +` + + for _, delim := range []string{" ", ","} { + environ := []string{"HUGO_DISABLELANGUAGES=sv no", "HUGO_DISABLEKINDS=taxonomy term"} + for i, v := range environ { + environ[i] = strings.ReplaceAll(v, " ", delim) + } + b := NewIntegrationTestBuilder( + IntegrationTestConfig{ + T: t, + TxtarString: files, + Environ: environ, + BuildCfg: BuildCfg{SkipRender: true}, + }, + ).Build() + + conf := b.H.Configs.Base + b.Assert(conf.DisableLanguages, qt.DeepEquals, []string{"sv", "no"}) + b.Assert(conf.DisableKinds, qt.DeepEquals, []string{"taxonomy", "term"}) + } + +} + func TestLoadMultiConfig(t *testing.T) { t.Parallel() |