MCPcopy Index your code
hub / github.com/expr-lang/expr / TestPatch_change_ident

Function TestPatch_change_ident

test/patch/change_ident_test.go:14–38  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

12)
13
14func TestPatch_change_ident(t *testing.T) {
15 program, err := expr.Compile(
16 `foo`,
17 expr.Env(Env{}),
18 expr.Patch(changeIdent{}),
19 )
20 require.NoError(t, err)
21
22 expected := &vm.Program{
23 Bytecode: []vm.Opcode{
24 vm.OpLoadField,
25 },
26 Arguments: []int{
27 0,
28 },
29 Constants: []any{
30 &runtime.Field{
31 Path: []string{"bar"},
32 Index: []int{1},
33 },
34 },
35 }
36
37 require.Equal(t, expected.Disassemble(), program.Disassemble())
38}
39
40type Env struct {
41 Foo int `expr:"foo"`

Callers

nothing calls this directly

Calls 6

DisassembleMethod · 0.95
CompileFunction · 0.92
EnvStruct · 0.92
PatchFunction · 0.92
NoErrorFunction · 0.92
EqualFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…