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

Function TestDefaultUTCTimeZoneError

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

Source from the content-addressed store, hash-verified

2660}
2661
2662func TestDefaultUTCTimeZoneError(t *testing.T) {
2663 env := testEnv(t, Variable("x", TimestampType))
2664 out, err := interpret(t, env, `
2665 x.getFullYear(':xx') == 1969
2666 || x.getDayOfYear('xx:') == 364
2667 || x.getMonth('Am/Ph') == 11
2668 || x.getDayOfMonth('Am/Ph') == 30
2669 || x.getDate('Am/Ph') == 31
2670 || x.getDayOfWeek('Am/Ph') == 3
2671 || x.getHours('Am/Ph') == 19
2672 || x.getMinutes('Am/Ph') == 5
2673 || x.getSeconds('Am/Ph') == 6
2674 || x.getMilliseconds('Am/Ph') == 1
2675 `, map[string]any{
2676 "x": time.Unix(7506, 1000000).Local(),
2677 })
2678 if err == nil {
2679 t.Fatalf("prg.Eval() got %v wanted error", out)
2680 }
2681}
2682
2683func TestParserRecursionLimit(t *testing.T) {
2684 testCases := []struct {

Callers

nothing calls this directly

Calls 3

interpretFunction · 0.85
testEnvFunction · 0.70
VariableFunction · 0.70

Tested by

no test coverage detected