Skip to content

Commit

Permalink
Timezone tests
Browse files Browse the repository at this point in the history
  • Loading branch information
zix99 committed Jul 15, 2022
1 parent 9631168 commit 7853a6b
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions pkg/expressions/stdlib/funcsTime_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,25 @@ func TestTimeAttrArgErrorExtra(t *testing.T) {
"<<ARGN>>")
}

// Utilities
func TestLoadingTimezone(t *testing.T) {
tz, ok := parseTimezoneLocation("utc")
assert.Equal(t, tz, time.UTC)
assert.True(t, ok)

tz, ok = parseTimezoneLocation("Local")
assert.Equal(t, tz, time.Local)
assert.True(t, ok)

tz, ok = parseTimezoneLocation("America/New_York")
assert.NotNil(t, tz)
assert.True(t, ok)

tz, ok = parseTimezoneLocation("not a real timezone")
assert.Equal(t, tz, time.UTC)
assert.False(t, ok)
}

// BenchmarkTimeParseExpression-4 537970 2133 ns/op 536 B/op 9 allocs/op
func BenchmarkTimeParseExpression(b *testing.B) {
stage := kfTimeParse([]expressions.KeyBuilderStage{
Expand Down

0 comments on commit 7853a6b

Please sign in to comment.