MCPcopy Create free account
hub / github.com/cel-expr/cel-go / TestDefaultUTCTimeZoneError

Function TestDefaultUTCTimeZoneError

cel/cel_test.go:3058–3077  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

3056}
3057
3058func TestDefaultUTCTimeZoneError(t *testing.T) {
3059 env := testEnv(t, Variable("x", TimestampType))
3060 out, err := interpret(t, env, `
3061 x.getFullYear(':xx') == 1969
3062 || x.getDayOfYear('xx:') == 364
3063 || x.getMonth('Am/Ph') == 11
3064 || x.getDayOfMonth('Am/Ph') == 30
3065 || x.getDate('Am/Ph') == 31
3066 || x.getDayOfWeek('Am/Ph') == 3
3067 || x.getHours('Am/Ph') == 19
3068 || x.getMinutes('Am/Ph') == 5
3069 || x.getSeconds('Am/Ph') == 6
3070 || x.getMilliseconds('Am/Ph') == 1
3071 `, map[string]any{
3072 "x": time.Unix(7506, 1000000).Local(),
3073 })
3074 if err == nil {
3075 t.Fatalf("prg.Eval() got %v wanted error", out)
3076 }
3077}
3078
3079func TestTimeZoneOffsetOutOfRange(t *testing.T) {
3080 env := testEnv(t, Variable("x", TimestampType))

Callers

nothing calls this directly

Calls 3

interpretFunction · 0.85
testEnvFunction · 0.70
VariableFunction · 0.70

Tested by

no test coverage detected