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

Function TestDefaultUTCTimeZoneError

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

Source from the content-addressed store, hash-verified

2680}
2681
2682func TestDefaultUTCTimeZoneError(t *testing.T) {
2683 env := testEnv(t, Variable("x", TimestampType))
2684 out, err := interpret(t, env, `
2685 x.getFullYear(':xx') == 1969
2686 || x.getDayOfYear('xx:') == 364
2687 || x.getMonth('Am/Ph') == 11
2688 || x.getDayOfMonth('Am/Ph') == 30
2689 || x.getDate('Am/Ph') == 31
2690 || x.getDayOfWeek('Am/Ph') == 3
2691 || x.getHours('Am/Ph') == 19
2692 || x.getMinutes('Am/Ph') == 5
2693 || x.getSeconds('Am/Ph') == 6
2694 || x.getMilliseconds('Am/Ph') == 1
2695 `, map[string]any{
2696 "x": time.Unix(7506, 1000000).Local(),
2697 })
2698 if err == nil {
2699 t.Fatalf("prg.Eval() got %v wanted error", out)
2700 }
2701}
2702
2703func TestParserRecursionLimit(t *testing.T) {
2704 testCases := []struct {

Callers

nothing calls this directly

Calls 3

interpretFunction · 0.85
testEnvFunction · 0.70
VariableFunction · 0.70

Tested by

no test coverage detected