MCPcopy
hub / github.com/expr-lang/expr / TestEval_slices_out_of_bound

Function TestEval_slices_out_of_bound

expr_test.go:2335–2353  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

2333}
2334
2335func TestEval_slices_out_of_bound(t *testing.T) {
2336 tests := []struct {
2337 code string
2338 want any
2339 }{
2340 {"[1, 2, 3][:99]", []any{1, 2, 3}},
2341 {"[1, 2, 3][99:]", []any{}},
2342 {"[1, 2, 3][:-99]", []any{}},
2343 {"[1, 2, 3][-99:]", []any{1, 2, 3}},
2344 }
2345
2346 for _, tt := range tests {
2347 t.Run(tt.code, func(t *testing.T) {
2348 got, err := expr.Eval(tt.code, nil)
2349 require.NoError(t, err, "eval error: "+tt.code)
2350 assert.Equal(t, tt.want, got, "eval: "+tt.code)
2351 })
2352 }
2353}
2354
2355func TestExpr_timeout(t *testing.T) {
2356 tests := []struct{ code string }{

Callers

nothing calls this directly

Calls 4

EvalFunction · 0.92
NoErrorFunction · 0.92
EqualFunction · 0.92
RunMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…