Fail on invalid defaultContentLanguage

Fixes #11044
This commit is contained in:
Bjørn Erik Pedersen
2023-05-30 11:53:38 +02:00
parent 6462eecfbd
commit 9cdca1f958
2 changed files with 48 additions and 1 deletions

View File

@@ -1122,4 +1122,32 @@ Foo: {{ site.Params.foo }}|
b.Assert(err.Error(), qt.Contains, "no languages")
})
// Issue 11044
t.Run("invalid defaultContentLanguage", func(t *testing.T) {
files := `
-- hugo.toml --
baseURL = "https://example.org"
defaultContentLanguage = "sv"
[languages]
[languages.en]
languageCode = "en"
languageName = "English"
weight = 1
`
b, err := NewIntegrationTestBuilder(
IntegrationTestConfig{
T: t,
TxtarString: files,
},
).BuildE()
b.Assert(err, qt.IsNotNil)
b.Assert(err.Error(), qt.Contains, "defaultContentLanguage does not match any language definition")
})
}