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

Function TestDeref_pointer_of_interface

test/deref/deref_test.go:144–164  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

142}
143
144func TestDeref_pointer_of_interface(t *testing.T) {
145 v := 42
146 a := &v
147 b := any(a)
148 c := any(&b)
149 t.Run("returned as is", func(t *testing.T) {
150 output, err := expr.Eval(`c`, map[string]any{
151 "c": c,
152 })
153 require.NoError(t, err)
154 require.Equal(t, c, output)
155 require.IsType(t, (*interface{})(nil), output)
156 })
157 t.Run("+ works", func(t *testing.T) {
158 output, err := expr.Eval(`c+2`, map[string]any{
159 "c": c,
160 })
161 require.NoError(t, err)
162 require.Equal(t, 44, output)
163 })
164}
165
166func TestDeref_nil(t *testing.T) {
167 var b *int = nil

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…