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

Function TestIssue785_get_nil

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

Source from the content-addressed store, hash-verified

2818}
2819
2820func TestIssue785_get_nil(t *testing.T) {
2821 exprStrs := []string{
2822 `get(nil, "a")`,
2823 `get({}, "a")`,
2824 `get(nil, "a")`,
2825 `get({}, "a")`,
2826 `({} | get("a") | get("b"))`,
2827 }
2828
2829 for _, exprStr := range exprStrs {
2830 t.Run("get returns nil", func(t *testing.T) {
2831 env := map[string]interface{}{}
2832
2833 result, err := expr.Eval(exprStr, env)
2834 require.NoError(t, err)
2835
2836 require.Equal(t, nil, result)
2837 })
2838 }
2839}
2840
2841func TestMaxNodes(t *testing.T) {
2842 maxNodes := uint(100)

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…