Fail on invalid time zone

Fixes #8832
This commit is contained in:
Bjørn Erik Pedersen
2021-08-01 11:50:12 +02:00
parent e3dc5240f0
commit 4d221ce468
3 changed files with 49 additions and 15 deletions

View File

@@ -15,6 +15,9 @@ package hugolib
import (
"fmt"
qt "github.com/frankban/quicktest"
"strings"
"testing"
)
@@ -186,3 +189,17 @@ ExpiryDate: 2099-07-13 15:28:01 +0000 UTC`
b.AssertFileContent("public/nn/short-date-toml-qouted/index.html", expectShortDateNn)
}
// Issue 8832
func TestTimeZoneInvalid(t *testing.T) {
b := newTestSitesBuilder(t)
b.WithConfigFile("toml", `
timeZone = "America/LosAngeles" # Should be America/Los_Angeles
`)
err := b.CreateSitesE()
b.Assert(err, qt.Not(qt.IsNil))
b.Assert(err.Error(), qt.Contains, `failed to load config: invalid timeZone for language "en": unknown time zone America/LosAngeles`)
}