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

Function TestDeref_multiple_pointers

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

Source from the content-addressed store, hash-verified

121}
122
123func TestDeref_multiple_pointers(t *testing.T) {
124 a := 42
125 b := &a
126 c := &b
127 t.Run("returned as is", func(t *testing.T) {
128 output, err := expr.Eval(`c`, map[string]any{
129 "c": c,
130 })
131 require.NoError(t, err)
132 require.Equal(t, c, output)
133 require.IsType(t, (**int)(nil), output)
134 })
135 t.Run("+ works", func(t *testing.T) {
136 output, err := expr.Eval(`c+2`, map[string]any{
137 "c": c,
138 })
139 require.NoError(t, err)
140 require.Equal(t, 44, output)
141 })
142}
143
144func TestDeref_pointer_of_interface(t *testing.T) {
145 v := 42

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…