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

Function TestDefaultUTCTimeZoneError

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

Source from the content-addressed store, hash-verified

2854}
2855
2856func TestDefaultUTCTimeZoneError(t *testing.T) {
2857 env := testEnv(t, Variable("x", TimestampType))
2858 out, err := interpret(t, env, `
2859 x.getFullYear(':xx') == 1969
2860 || x.getDayOfYear('xx:') == 364
2861 || x.getMonth('Am/Ph') == 11
2862 || x.getDayOfMonth('Am/Ph') == 30
2863 || x.getDate('Am/Ph') == 31
2864 || x.getDayOfWeek('Am/Ph') == 3
2865 || x.getHours('Am/Ph') == 19
2866 || x.getMinutes('Am/Ph') == 5
2867 || x.getSeconds('Am/Ph') == 6
2868 || x.getMilliseconds('Am/Ph') == 1
2869 `, map[string]any{
2870 "x": time.Unix(7506, 1000000).Local(),
2871 })
2872 if err == nil {
2873 t.Fatalf("prg.Eval() got %v wanted error", out)
2874 }
2875}
2876
2877func TestTimeZoneOffsetOutOfRange(t *testing.T) {
2878 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