MCPcopy Create free account
hub / github.com/expr-lang/expr / TestTime_duration

Function TestTime_duration

test/time/time_test.go:106–116  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

104}
105
106func TestTime_duration(t *testing.T) {
107 env := map[string]any{
108 "foo": time.Date(2000, time.Month(1), 1, 0, 0, 0, 0, time.UTC),
109 }
110 program, err := expr.Compile(`now() - duration("1h") < now() && foo + duration("24h") < now()`, expr.Env(env))
111 require.NoError(t, err)
112
113 output, err := expr.Run(program, env)
114 require.NoError(t, err)
115 require.Equal(t, true, output)
116}
117
118func TestTime_date(t *testing.T) {
119 var tests = []struct {

Callers

nothing calls this directly

Calls 5

CompileFunction · 0.92
EnvStruct · 0.92
NoErrorFunction · 0.92
RunFunction · 0.92
EqualFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…