MCPcopy Create free account
hub / github.com/pace/bricks / TestTimezone

Function TestTimezone

locale/locale_test.go:37–49  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

35}
36
37func TestTimezone(t *testing.T) {
38 l := NewLocale(None, "Europe/Berlin")
39
40 assert.False(t, l.HasLanguage())
41 assert.True(t, l.HasTimezone())
42 assert.Equal(t, None, l.Language())
43 assert.Equal(t, "Europe/Berlin", l.Timezone())
44
45 loc, err := l.Location()
46 assert.NoError(t, err)
47 timeInUTC := time.Date(2018, 8, 30, 12, 0, 0, 0, time.UTC)
48 assert.Equal(t, "2018-08-30 14:00:00 +0200 CEST", timeInUTC.In(loc).String())
49}
50
51func TestTimezoneAndLocale(t *testing.T) {
52 l := NewLocale("fr-CH, fr;q=0.9, en;q=0.8, de;q=0.7, *;q=0.5", "Europe/Berlin")

Callers

nothing calls this directly

Calls 7

HasLanguageMethod · 0.95
HasTimezoneMethod · 0.95
LanguageMethod · 0.95
TimezoneMethod · 0.95
LocationMethod · 0.95
NewLocaleFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…